️ feat: update date picker input icon

This commit is contained in:
Wahyu Kurniawan 2024-03-05 05:06:53 +07:00
parent e9f32ff668
commit d9bae720d7
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33

View File

@ -3,7 +3,10 @@ import { Input, InputProps } from 'components/shared/Input';
import * as Popover from '@radix-ui/react-popover'; import * as Popover from '@radix-ui/react-popover';
import { datePickerTheme } from './DatePicker.theme'; import { datePickerTheme } from './DatePicker.theme';
import { Calendar, CalendarProps } from 'components/shared/Calendar'; import { Calendar, CalendarProps } from 'components/shared/Calendar';
import { CalendarIcon } from 'components/shared/CustomIcon'; import {
CalendarIcon,
ChevronGrabberHorizontal,
} from 'components/shared/CustomIcon';
import { Value } from 'react-calendar/dist/cjs/shared/types'; import { Value } from 'react-calendar/dist/cjs/shared/types';
import { format } from 'date-fns'; import { format } from 'date-fns';
@ -64,7 +67,7 @@ export const DatePicker = ({
} }
return format(value, 'dd/MM/yyyy'); return format(value, 'dd/MM/yyyy');
}, [value, onReset]); }, [value, onReset]);
console.log(renderValue);
/** /**
* Handles the selection of a date from the calendar. * Handles the selection of a date from the calendar.
*/ */
@ -86,7 +89,8 @@ export const DatePicker = ({
<Popover.Trigger className="w-full"> <Popover.Trigger className="w-full">
<Input <Input
{...props} {...props}
rightIcon={<CalendarIcon onClick={() => setOpen(true)} />} leftIcon={<CalendarIcon onClick={() => setOpen(true)} />}
rightIcon={<ChevronGrabberHorizontal />}
readOnly readOnly
placeholder="Select a date..." placeholder="Select a date..."
value={renderValue} value={renderValue}