-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.tsx
68 lines (66 loc) · 2.29 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { ComponentProps } from 'react';
import { DayPicker } from 'react-day-picker';
import { ReactComponent as Chevron } from 'assets/icons/chevron.svg';
import { cn } from 'utils/helpers';
export type CalendarProps = ComponentProps<typeof DayPicker>;
export const Calendar = ({
className,
classNames,
showOutsideDays = true,
weekStartsOn = 1,
...props
}: CalendarProps) => {
return (
<DayPicker
showOutsideDays={showOutsideDays}
className={className}
classNames={{
months: 'flex flex-col sm:flex-row gap-30',
month: 'flex flex-col gap-20',
caption: 'flex items-center',
caption_start: '[&>:first-child]:flex-row-reverse',
caption_label: 'flex-1 text-center text-14',
nav: 'gap-10 flex items-center',
nav_button: 'size-16 bg-transparent opacity-50 hover:opacity-100',
table: 'border-collapse',
head_row: 'flex m-b-1',
head_cell: 'text-white/20 rounded-8 w-36 text-12 font-weight-400',
row: 'flex w-full mt-4',
cell: 'p-0 text-14',
day: cn(
'text-white/60 h-32 w-36 p-0 rounded-8 border-box',
'focus-visible:border focus-visible:border-white/50 focus-visible:outline-none',
'hover:!bg-background-900 hover:text-white'
),
day_selected:
'focus-visible:bg-primary/80 font-weight-500 !text-white bg-primary/20 !rounded-0 [&:not(.outside)]:opacity-100',
day_range_start:
'!rounded-l-8 [&:not(.outside)]:!bg-primary [&:not(.outside)]:!text-black',
day_range_end:
'!rounded-r-8 [&:not(.outside)]:!bg-primary [&:not(.outside)]:!text-black',
day_today: 'border border-white/80',
day_outside: 'outside opacity-20',
day_disabled: '!text-white/20 !opacity-50',
day_range_middle: 'aria-selected:bg-primary/20',
day_hidden: 'invisible',
...classNames,
}}
components={{
IconLeft: () => (
<Chevron
className="size-16 rotate-90"
data-testid="date-picker-left-arrow"
/>
),
IconRight: () => (
<Chevron
className="size-16 -rotate-90"
data-testid="date-picker-right-arrow"
/>
),
}}
weekStartsOn={weekStartsOn}
{...props}
/>
);
};