-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.tsx
91 lines (87 loc) · 3.17 KB
/
page.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use client';
import React from 'react';
import Datepicker from '@/index';
// These are all possible props for the Datepicker component
export default function Page() {
const [date, setDate] = React.useState<Date>();
const [multipleDate, setMultipleDate] = React.useState<Date[]>();
const [dateRange, setDateRange] = React.useState<{ startDate: Date; endDate: Date }>();
return (
<div className="m-12 flex flex-col flex-wrap items-start gap-2">
<Datepicker type="single" value={date} onChange={setDate} placeholder="Single - Normal" />
<Datepicker
type="single"
value={date}
onChange={setDate}
placeholder="Single - Custom styling"
classNames={{
calendar: 'bg-red-500'
// ...
}}
/>
<Datepicker
type="single"
value={date}
onChange={setDate}
placeholder="Single - Custom icons"
icons={{
nextMonth: '',
previousMonth: ''
}}
/>
<Datepicker type="single" value={date} onChange={setDate} placeholder="Single - Custom button">
{(props) => <button>{JSON.stringify(props.value)}</button>}
</Datepicker>
<Datepicker
type="single"
value={date}
onChange={setDate}
placeholder="Single - Disabled"
disabled={[
{
from: new Date(2024, 0, 10),
to: new Date(2024, 0, 12)
},
{
from: new Date(2024, 0, 15),
to: new Date(2024, 0, 18)
},
{
from: new Date(2024, 0, 20),
to: new Date(2024, 0, 20)
}
]}
/>
<Datepicker type="single" value={date} onChange={setDate} dir="rtl" placeholder="Single - RTL" />
<Datepicker type="single" value={date} onChange={setDate} dir="rtl" locale="ar-SA" placeholder="Single - RTL - Locale" />
<Datepicker type="multiple" value={multipleDate} onChange={setMultipleDate} placeholder="Multiple - Normal" />
<Datepicker type="multiple" value={multipleDate} onChange={setMultipleDate} max={3} placeholder="Multiple - Max" />
<Datepicker type="multiple" value={multipleDate} onChange={setMultipleDate} min={3} placeholder="Multiple - Min" />
<Datepicker type="range" value={dateRange} onChange={setDateRange} placeholder="Range - Normal" />
<Datepicker type="range" value={dateRange} onChange={setDateRange} min={1} placeholder="Range - Min/max" />
<Datepicker type="range" value={dateRange} onChange={setDateRange} expand placeholder="Range - Expand" />
<Datepicker type="range" value={dateRange} onChange={setDateRange} expand shortcuts placeholder="Range - Expand - Shortcuts" />
<Datepicker
type="range"
value={dateRange}
onChange={setDateRange}
expand
locale="nl-NL"
shortcuts={{
all_time: 'Selecteer alles'
// ...
}}
placeholder="Range - Expand - Custom Shortcuts"
/>
<Datepicker
type="range"
value={dateRange}
onChange={setDateRange}
expand
shortcuts
footer
placeholder="Range - Expand - Shortcuts - Footer"
/>
</div>
);
}