2019-08-08 13:16:08 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
2019-08-13 13:24:48 +00:00
|
|
|
import { withKnobs, boolean, text, color, select, date } from '@storybook/addon-knobs/react';
|
2019-08-08 13:16:08 +00:00
|
|
|
import withReadme from 'storybook-readme/with-readme';
|
|
|
|
import Readme from './README.md';
|
|
|
|
import { Calendar } from 'asc-web-components';
|
|
|
|
import Section from '../../../.storybook/decorators/section';
|
2019-08-15 12:34:23 +00:00
|
|
|
//import moment from 'moment/min/moment-with-locales';
|
|
|
|
import moment from 'moment';
|
|
|
|
import 'moment/min/locales'
|
2019-08-08 13:16:08 +00:00
|
|
|
|
2019-08-09 15:20:57 +00:00
|
|
|
function myDateKnob(name, defaultValue) {
|
|
|
|
const stringTimestamp = date(name, defaultValue)
|
|
|
|
return new Date(stringTimestamp)
|
|
|
|
}
|
2019-08-08 13:16:08 +00:00
|
|
|
|
|
|
|
storiesOf('Components|Input', module)
|
2019-08-09 09:54:53 +00:00
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.addDecorator(withReadme(Readme))
|
|
|
|
.add('calendar', () => (
|
|
|
|
<Section>
|
|
|
|
<Calendar
|
2019-08-08 13:16:08 +00:00
|
|
|
onChange={date => {
|
2019-08-13 13:24:48 +00:00
|
|
|
action('Selected date')(date);
|
2019-08-08 13:16:08 +00:00
|
|
|
}}
|
2019-08-13 13:24:48 +00:00
|
|
|
//dateFormat={text('dateFormat', 'dd.MM.yyyy')}
|
2019-08-09 09:54:53 +00:00
|
|
|
disabled={boolean('disabled', false)}
|
|
|
|
themeColor={color('themeColor', '#ED7309')}
|
2019-08-13 14:38:46 +00:00
|
|
|
selectedDate={myDateKnob('selectedDate', new Date())}
|
2019-08-09 15:20:57 +00:00
|
|
|
openToDate={myDateKnob('openToDate', new Date())}
|
2019-08-13 13:24:48 +00:00
|
|
|
minDate={myDateKnob('minDate', new Date("2018/02/01"))}
|
|
|
|
maxDate={myDateKnob('maxDate', new Date("2019/09/01"))}
|
2019-08-13 14:38:46 +00:00
|
|
|
location={select('location', moment.locales(), 'en')}
|
2019-08-08 13:16:08 +00:00
|
|
|
/>
|
2019-08-09 09:54:53 +00:00
|
|
|
</Section>
|
|
|
|
));
|