date picker 수정_ 1. selectClass 2.아이콘 간격 css수정 3.color white고정

This commit is contained in:
leedj312
2025-03-13 11:32:11 +09:00
parent 71e70c842b
commit ffb15a7e3a
@@ -10,26 +10,28 @@ import { Button, Calendar, Popover, PopoverContent, PopoverTrigger } from "@comm
import { cn } from "../../lib/utils"; import { cn } from "../../lib/utils";
import { FormControl } from "../form"; import { FormControl } from "../form";
type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void } }; type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void } ,selectClass:string|undefined };
export function DatePicker({ field }: DatePickerProps) { export function DatePicker({ field, selectClass }: DatePickerProps) {
return ( return (
<Popover> <Popover>
<PopoverTrigger asChild> <PopoverTrigger asChild>
<FormControl> <FormControl>
<Button <Button
color="white"
variant={"outline"} variant={"outline"}
className={cn( className={!selectClass? cn(
"w-[240px] pl-3 text-left font-normal", "w-[240px] pl-3 text-left font-normal",
!field?.value && "text-muted-foreground" !field?.value && "text-muted-foreground",
)}
):selectClass}
> >
{field?.value ? ( {field?.value ? (
format(field?.value, "PPP") format(field?.value, "PPP")
) : ( ) : (
<span>Pick a date</span> <span>Pick a date</span>
)} )}
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" /> <CalendarIcon className="h-4" />
</Button> </Button>
</FormControl> </FormControl>
</PopoverTrigger> </PopoverTrigger>