pageTimeRangeSelector.stories.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {Fragment} from 'react';
  2. import omit from 'lodash/omit';
  3. import DateTime from 'sentry/components/dateTime';
  4. import PageTimeRangeSelector from 'sentry/components/pageTimeRangeSelector';
  5. import {DEFAULT_RELATIVE_PERIODS} from 'sentry/constants';
  6. import {t} from 'sentry/locale';
  7. export default {
  8. title: 'Components/PageTimeRangeSelector',
  9. component: PageTimeRangeSelector,
  10. };
  11. const start = '2021-07-25T08:49:32Z';
  12. const end = '2021-07-27T12:55:17Z';
  13. export const _PageTimeRangeSelector = () => <PageTimeRangeSelector />;
  14. _PageTimeRangeSelector.storyName = 'Basic';
  15. export const _PageTimeRangeSelectorWithDefault = () => (
  16. <PageTimeRangeSelector defaultPeriod="90d" />
  17. );
  18. _PageTimeRangeSelectorWithDefault.storyName = 'With Custom Default';
  19. export const _PageTimeRangeSelectorWithOptions = () => (
  20. <PageTimeRangeSelector
  21. relativeOptions={{
  22. release: (
  23. <Fragment>
  24. {t('Entire Release Period')} (
  25. <DateTime date={start} /> - <DateTime date={end} />)
  26. </Fragment>
  27. ),
  28. ...omit(DEFAULT_RELATIVE_PERIODS, ['1h']),
  29. }}
  30. defaultPeriod="release"
  31. />
  32. );
  33. _PageTimeRangeSelectorWithOptions.storyName = 'With Custom Options';
  34. export const _PageTimeRangeSelectorWithoutAbsolute = () => (
  35. <PageTimeRangeSelector showAbsolute={false} />
  36. );
  37. _PageTimeRangeSelectorWithoutAbsolute.storyName = 'Without Absolute';