DocSpace-client/web/ASC.Web.Storybook/stories/input/date/index.stories.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-06-27 14:36:42 +00:00
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
2019-06-28 12:40:40 +00:00
import { DateValue } from 'react-values'
2019-07-01 09:34:22 +00:00
import { withKnobs, boolean, text } from '@storybook/addon-knobs/react';
2019-06-27 14:36:42 +00:00
import withReadme from 'storybook-readme/with-readme';
import Readme from './README.md';
import { DateInput } from 'asc-web-components';
import Section from '../../../.storybook/decorators/section';
storiesOf('Components|Input', module)
2019-07-01 09:34:22 +00:00
.addDecorator(withKnobs)
2019-06-27 14:36:42 +00:00
.addDecorator(withReadme(Readme))
.add('date', () => (
<Section>
2019-06-28 12:40:40 +00:00
<DateValue>
{({ value, set }) => (
2019-06-27 14:36:42 +00:00
<DateInput
2019-07-01 09:34:22 +00:00
id={text('id', '')}
name={text('name', '')}
disabled={boolean('disabled', false)}
readOnly={boolean('readOnly', false)}
2019-06-28 12:40:40 +00:00
selected={value}
onChange={date => {
action('onChange')(date);
set(date);
2019-06-27 14:36:42 +00:00
}}
2019-07-01 09:34:22 +00:00
dateFormat={text('dateFormat', 'dd.MM.yyyy')}
hasError={boolean('hasError', false)}
hasWarning={boolean('hasWarning', false)}
2019-06-27 14:36:42 +00:00
/>
)}
2019-06-28 12:40:40 +00:00
</DateValue>
2019-06-27 14:36:42 +00:00
</Section>
));