diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsx deleted file mode 100644 index 25042200..00000000 --- a/src/components/ui/calendar.tsx +++ /dev/null @@ -1,222 +0,0 @@ -'use client'; - -import { - ChevronDownIcon, - ChevronLeftIcon, - ChevronRightIcon, -} from 'lucide-react'; -import * as React from 'react'; -import { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker'; - -import { Button, buttonVariants } from '@/components/ui/button'; -import { cn } from '@/lib/utils'; - -function Calendar({ - className, - classNames, - showOutsideDays = true, - captionLayout = 'label', - buttonVariant = 'ghost', - formatters, - fromDate, - toDate, - components, - ...props -}: React.ComponentProps & { - buttonVariant?: React.ComponentProps['variant']; - fromDate?: Date; - toDate?: Date; -}) { - const defaultClassNames = getDefaultClassNames(); - - return ( - svg]:rotate-180`, - String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, - className, - )} - captionLayout={captionLayout} - formatters={{ - formatMonthDropdown: (date) => - date.toLocaleString('default', { month: 'short' }), - ...formatters, - }} - classNames={{ - root: cn('w-fit', defaultClassNames.root), - months: cn( - 'flex gap-4 flex-col md:flex-row relative', - defaultClassNames.months, - ), - month: cn('flex flex-col w-full gap-4', defaultClassNames.month), - nav: cn( - 'flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', - defaultClassNames.nav, - ), - button_previous: cn( - buttonVariants({ variant: buttonVariant }), - 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', - defaultClassNames.button_previous, - ), - button_next: cn( - buttonVariants({ variant: buttonVariant }), - 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', - defaultClassNames.button_next, - ), - month_caption: cn( - 'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)', - defaultClassNames.month_caption, - ), - dropdowns: cn( - 'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5', - defaultClassNames.dropdowns, - ), - dropdown_root: cn( - 'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md', - defaultClassNames.dropdown_root, - ), - dropdown: cn( - 'absolute bg-popover inset-0 opacity-0', - defaultClassNames.dropdown, - ), - caption_label: cn( - 'select-none font-medium', - captionLayout === 'label' - ? 'text-sm' - : 'rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5', - defaultClassNames.caption_label, - ), - table: 'w-full border-collapse', - weekdays: cn('flex', defaultClassNames.weekdays), - weekday: cn( - 'text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none', - defaultClassNames.weekday, - ), - week: cn('flex w-full mt-2', defaultClassNames.week), - week_number_header: cn( - 'select-none w-(--cell-size)', - defaultClassNames.week_number_header, - ), - week_number: cn( - 'text-[0.8rem] select-none text-muted-foreground', - defaultClassNames.week_number, - ), - day: cn( - 'relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none', - props.showWeekNumber - ? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-md' - : '[&:first-child[data-selected=true]_button]:rounded-l-md', - defaultClassNames.day, - ), - range_start: cn( - 'rounded-l-md bg-accent', - defaultClassNames.range_start, - ), - range_middle: cn('rounded-none', defaultClassNames.range_middle), - range_end: cn('rounded-r-md bg-accent', defaultClassNames.range_end), - today: cn( - 'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none', - defaultClassNames.today, - ), - outside: cn( - 'text-muted-foreground aria-selected:text-muted-foreground', - defaultClassNames.outside, - ), - disabled: cn( - 'text-muted-foreground opacity-50', - defaultClassNames.disabled, - ), - hidden: cn('invisible', defaultClassNames.hidden), - ...classNames, - }} - components={{ - Root: ({ className, rootRef, ...props }) => { - return ( -
- ); - }, - Chevron: ({ className, orientation, ...props }) => { - if (orientation === 'left') { - return ( - - ); - } - - if (orientation === 'right') { - return ( - - ); - } - - return ( - - ); - }, - DayButton: CalendarDayButton, - WeekNumber: ({ children, ...props }) => { - return ( - -
- {children} -
- - ); - }, - ...components, - }} - {...props} - /> - ); -} - -function CalendarDayButton({ - className, - day, - modifiers, - ...props -}: React.ComponentProps) { - const defaultClassNames = getDefaultClassNames(); - - const ref = React.useRef(null); - React.useEffect(() => { - if (modifiers.focused) ref.current?.focus(); - }, [modifiers.focused]); - - return ( - - - - { - if (date) { - onChange(format(date, 'yyyy-MM-dd')); - setOpen(false); - } - }} - fromDate={minDate} - toDate={maxDate} - /> - - - {(error || helperText) && ( -
- {error || helperText} -
- )} + + +
+ + 날짜 선택 + +
+ +
+ +
+
+
); diff --git a/src/global/components/LongButton.tsx b/src/global/components/LongButton.tsx index ebe8cc41..3ba12534 100644 --- a/src/global/components/LongButton.tsx +++ b/src/global/components/LongButton.tsx @@ -7,6 +7,7 @@ interface LongButtonProps { noFixed?: boolean; // true면 fixed 해제하고 가로 100% 채움 height?: number; // 버튼 세로(px) safeArea?: boolean; // false면 safe-area-inset-bottom 미적용 + className?: string; // 추가 className } export default function LongButton({ @@ -18,6 +19,7 @@ export default function LongButton({ noFixed = false, height, safeArea = true, + className = '', }: LongButtonProps) { // noFixed가 true면 스타일 속성 없음, false면 left/right/bottom 값 적용 const buttonStyle = { @@ -45,7 +47,7 @@ export default function LongButton({ disabled ? 'bg-button-disabled-fill text-text-disabled cursor-not-allowed' : 'bg-button-primary-fill text-text-primary active:bg-button-primary-fill-pressed active:text-text-primary' - } `} + } ${className}`} > {text}