forked from cerc-io/snowballtools-base
⚡️ feat: add interaction on the example page
This commit is contained in:
parent
af0d28e654
commit
dc6bf3794a
@ -1,9 +1,13 @@
|
|||||||
import { Button, ButtonOrLinkProps } from 'components/shared/Button';
|
import { Button, ButtonOrLinkProps } from 'components/shared/Button';
|
||||||
import { Calendar } from 'components/shared/Calendar';
|
import { Calendar } from 'components/shared/Calendar';
|
||||||
import { PlusIcon } from 'components/shared/CustomIcon';
|
import { PlusIcon } from 'components/shared/CustomIcon';
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import { Value } from 'react-calendar/dist/cjs/shared/types';
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
|
const [singleDate, setSingleDate] = useState<Value>();
|
||||||
|
const [dateRange, setDateRange] = useState<Value>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative h-full min-h-full">
|
<div className="relative h-full min-h-full">
|
||||||
<div className="flex flex-col items-center justify-center max-w-7xl mx-auto px-20 py-20">
|
<div className="flex flex-col items-center justify-center max-w-7xl mx-auto px-20 py-20">
|
||||||
@ -75,9 +79,25 @@ const Page = () => {
|
|||||||
<div className="w-full h border border-gray-200 px-20 my-10" />
|
<div className="w-full h border border-gray-200 px-20 my-10" />
|
||||||
<div className="flex flex-col gap-10 items-center justify-between">
|
<div className="flex flex-col gap-10 items-center justify-between">
|
||||||
<h1 className="text-2xl font-bold">Calendar</h1>
|
<h1 className="text-2xl font-bold">Calendar</h1>
|
||||||
<div className="flex gap-10 flex-wrap">
|
<div className="flex flex-col gap-10">
|
||||||
<Calendar />
|
<div className="space-y-5 flex flex-col items-center">
|
||||||
<Calendar selectRange />
|
<p>Selected date: {singleDate?.toString()}</p>
|
||||||
|
<Calendar
|
||||||
|
value={singleDate}
|
||||||
|
onChange={setSingleDate}
|
||||||
|
onSelect={setSingleDate}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-5 flex flex-col items-center">
|
||||||
|
<p>
|
||||||
|
Start date:{' '}
|
||||||
|
{dateRange instanceof Array ? dateRange[0]?.toString() : ''}{' '}
|
||||||
|
<br />
|
||||||
|
End date:{' '}
|
||||||
|
{dateRange instanceof Array ? dateRange[1]?.toString() : ''}
|
||||||
|
</p>
|
||||||
|
<Calendar selectRange value={dateRange} onChange={setDateRange} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user