-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stories for DateTimePickerElement
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {DateTimePickerElement, FormContainer} from '../src' | ||
import {ComponentMeta, ComponentStory} from '@storybook/react' | ||
import DateFnsProvider from '../src/DateFnsProvider' | ||
import {action} from '@storybook/addon-actions' | ||
import {SubmitButton} from '../src/Shared' | ||
|
||
export default { | ||
title: 'DateTimePickerElement', | ||
component: DateTimePickerElement | ||
} as ComponentMeta<typeof DateTimePickerElement> | ||
|
||
|
||
const Template: ComponentStory<typeof DateTimePickerElement> = (args) => ( | ||
<DateFnsProvider> | ||
<FormContainer defaultValues={{}} onSuccess={action('submit')}> | ||
<DateTimePickerElement {...args} /> | ||
<br/> | ||
<SubmitButton/> | ||
</FormContainer> | ||
</DateFnsProvider> | ||
) | ||
|
||
|
||
export const Basic = Template.bind({}) | ||
Basic.args = { | ||
label: 'Datetime Picker', | ||
name: 'basic' | ||
} | ||
|
||
export const RequiredPicker = Template.bind({}) | ||
RequiredPicker.args = { | ||
label: 'Datetime Picker', | ||
name: 'required_picker', | ||
required: true | ||
} | ||
|
||
export const RequiredPickerCustom = Template.bind({}) | ||
RequiredPickerCustom.args = { | ||
label: 'Datetime Picker', | ||
name: 'required_picker_custom', | ||
required: true, | ||
validation: {required: 'Custom required message'} | ||
} |