import React from 'react';
import DatePickerComponent from './DatePickerComponent';
import { DatePickerWrapper } from '../../../styles/Components';
import {
	FormRowGroup,
	FormLabel,
	DateContainer,
} from '../../../styles/ModuleComponents';
import { useTranslation } from 'react-i18next';

const SingleDatePicker = ({
							  label,
							  selectedDate,
							  onDateChange,
							  pastDate = new Date(),
							  disabled,
							  dateLabel = '선택 일자',
						  }) => {
	const { t } = useTranslation();

	const handleDate = (date) => {
		const newDate = new Date(date);
		onDateChange(newDate);
	};

	return (
		<>
			<FormLabel>{label}</FormLabel>
			<DateContainer>
				<DatePickerWrapper>
					<DatePickerComponent
						name={dateLabel}
						handleSelectedDate={handleDate}
						selectedDate={selectedDate}
						pastDate={pastDate}
						disabled={disabled}
					/>
				</DatePickerWrapper>
			</DateContainer>
		</>
	);
};

export default SingleDatePicker;