import ReactDatePicker from 'antd/es/date-picker';
import { useTheme } from '@mui/material';
import 'antd/es/date-picker/style/index';
interface DatePickerProps {
  value?: Date | null;
  onChange?: (date: Date | null) => void;
}

export const DatePicker = ({ value, onChange }: DatePickerProps) => {
  const theme = useTheme();
  const primaryColor = theme.palette.primary.main;
  return (
    <div>
      <ReactDatePicker
        placement='topLeft'
        placeholder='请选择日期'
        value={value}
        showNow={false}
        // showTime={true}
        onChange={(date) => onChange?.(date)} //
        style={{
          color: primaryColor,
        }}
        popupStyle={{ zIndex: 2000 }}
      />
    </div>
  );
};
