TimePickerCalendar.story.tsx 927 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import { storiesOf } from '@storybook/react';
  3. import { action } from '@storybook/addon-actions';
  4. import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
  5. import { TimePickerCalendar } from './TimePickerCalendar';
  6. import { UseState } from '../../utils/storybook/UseState';
  7. import { TimeFragment } from '../../types/time';
  8. const TimePickerCalendarStories = storiesOf('UI/TimePicker/TimePickerCalendar', module);
  9. TimePickerCalendarStories.addDecorator(withCenteredStory);
  10. TimePickerCalendarStories.add('default', () => (
  11. <UseState initialState={'now-6h' as TimeFragment}>
  12. {(value, updateValue) => {
  13. return (
  14. <TimePickerCalendar
  15. timeZone="browser"
  16. value={value}
  17. onChange={timeRange => {
  18. action('onChange fired')(timeRange);
  19. updateValue(timeRange);
  20. }}
  21. />
  22. );
  23. }}
  24. </UseState>
  25. ));