-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b974140
commit bcaee1a
Showing
38 changed files
with
1,193 additions
and
1,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,45 @@ | ||
import React, { useState } from 'react'; | ||
import React from 'react'; | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
import { Calendar, type CalendarProps } from '@var-meta/ui'; | ||
|
||
import { EnhancedView } from '@/components/View'; | ||
|
||
const mode = ['single', 'multiple', 'range']; | ||
|
||
const meta: Meta = { | ||
title: 'Components/DatePicker/Calendar', | ||
title: 'Components/Calendar/Calendar', | ||
component: Calendar, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
mode: { | ||
options: mode, | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const DefaultTemplate: StoryFn<CalendarProps> = ({ mode = 'single', ...args }) => { | ||
const [selected, setSelect] = useState<any>(); | ||
|
||
const DefaultTemplate: StoryFn<CalendarProps> = (args) => { | ||
return ( | ||
<EnhancedView prop="Default"> | ||
<Calendar selected={selected} onSelect={setSelect as any} mode={mode} {...args} /> | ||
<Calendar {...args} /> | ||
</EnhancedView> | ||
); | ||
}; | ||
|
||
export const Default: StoryFn<typeof Calendar> = DefaultTemplate.bind({}); | ||
|
||
const WithPickerTemplate: StoryFn<CalendarProps> = (args) => { | ||
return ( | ||
<EnhancedView prop="WithPicker"> | ||
<Calendar withPicker {...args} /> | ||
</EnhancedView> | ||
); | ||
}; | ||
|
||
export const WithPicker: StoryFn<typeof Calendar> = WithPickerTemplate.bind({}); | ||
|
||
const MultipleMonthsTemplate: StoryFn<CalendarProps> = (args) => { | ||
return ( | ||
<EnhancedView prop="MultipleMonths"> | ||
<Calendar visibleMonths={2} {...args} /> | ||
</EnhancedView> | ||
); | ||
}; | ||
|
||
export const MultipleMonths: StoryFn<typeof Calendar> = MultipleMonthsTemplate.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
import { DateInput, type DateInputProps } from '@var-meta/ui'; | ||
|
||
import { EnhancedView } from '@/components/View'; | ||
|
||
const meta: Meta = { | ||
title: 'Components/Calendar/DateInput', | ||
component: DateInput, | ||
tags: ['autodocs'], | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const DefaultTemplate: StoryFn<DateInputProps> = (args) => { | ||
return ( | ||
<EnhancedView prop="Default"> | ||
<DateInput {...args} /> | ||
</EnhancedView> | ||
); | ||
}; | ||
|
||
export const Default: StoryFn<typeof DateInput> = DefaultTemplate.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,43 @@ | ||
import React, { useState } from 'react'; | ||
import React from 'react'; | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
import { | ||
Button, | ||
CalendarIcon, | ||
DatePicker, | ||
Modal, | ||
Popper, | ||
useDisclosure, | ||
type Calendar, | ||
type DatePickerProps, | ||
} from '@var-meta/ui'; | ||
import dayjs from 'dayjs'; | ||
import { Button, DatePicker, Modal, ModalBody, ModalHeader } from '@var-meta/ui'; | ||
|
||
import { View } from '@/components/View'; | ||
|
||
const mode = ['single', 'multiple', 'range']; | ||
|
||
const meta: Meta = { | ||
title: 'Components/DatePicker/DatePicker', | ||
title: 'Components/Calendar/DatePicker', | ||
component: DatePicker, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
mode: { | ||
options: mode, | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const DefaultTemplate: StoryFn<DatePickerProps> = ({ ...args }) => { | ||
const [value, setValue] = useState<Date>(); | ||
const DefaultTemplate: StoryFn<typeof DatePicker> = ({ ...args }) => { | ||
return ( | ||
<View prop="Default"> | ||
<DatePicker {...args} onCancel={close} value={value} onChange={(date) => setValue(date)} /> | ||
<DatePicker {...args} /> | ||
</View> | ||
); | ||
}; | ||
|
||
export const Default: StoryFn<typeof Calendar> = DefaultTemplate.bind({}); | ||
|
||
const WithPopperTemplate: StoryFn<DatePickerProps> = ({ ...args }) => { | ||
const [value, setValue] = useState<Date>(); | ||
const [isOpen, { close, setOpened }] = useDisclosure(false); | ||
export const Default: StoryFn<typeof DatePicker> = DefaultTemplate.bind({}); | ||
|
||
const handleChange = (date?: Date) => { | ||
setValue(date); | ||
close(); | ||
}; | ||
const WithModalTemplate: StoryFn<typeof DatePicker> = ({ ...args }) => { | ||
return ( | ||
<View prop="Default"> | ||
<Popper | ||
onOpenChange={setOpened} | ||
open={isOpen} | ||
trigger={ | ||
<Button variant="link"> | ||
<CalendarIcon /> | ||
{value ? dayjs(value).format('MMM DD, YYYY') : 'Select date'} | ||
</Button> | ||
} | ||
> | ||
<DatePicker {...args} onCancel={close} value={value} onChange={handleChange} /> | ||
</Popper> | ||
</View> | ||
); | ||
}; | ||
|
||
export const WithPopper: StoryFn<typeof Calendar> = WithPopperTemplate.bind({}); | ||
|
||
const WithModalTemplate: StoryFn<DatePickerProps> = ({ ...args }) => { | ||
const [value, setValue] = useState<Date>(); | ||
const [isOpen, { close, setOpened }] = useDisclosure(false); | ||
|
||
const handleChange = (date?: Date) => { | ||
setValue(date); | ||
close(); | ||
}; | ||
return ( | ||
<View prop="Default"> | ||
<Modal | ||
className="max-w-fit" | ||
onOpenChange={setOpened} | ||
open={isOpen} | ||
fitContent | ||
trigger={ | ||
<Button variant="link"> | ||
<CalendarIcon /> | ||
{value ? dayjs(value).format('MMM DD, YYYY') : 'Select date'} | ||
</Button> | ||
} | ||
> | ||
<DatePicker {...args} onCancel={close} value={value} onChange={handleChange} /> | ||
<View prop="WithModal"> | ||
<Modal trigger={<Button>Show Modal</Button>}> | ||
<ModalHeader | ||
title="Blog post published" | ||
description="This blog post has been published. Team members will be able to edit this post and republish changes." | ||
/> | ||
<ModalBody> | ||
<DatePicker {...args} /> | ||
</ModalBody> | ||
</Modal> | ||
</View> | ||
); | ||
}; | ||
|
||
export const WithModal: StoryFn<typeof Calendar> = WithModalTemplate.bind({}); | ||
export const WithModal: StoryFn<typeof DatePicker> = WithModalTemplate.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.