detailedError.stories.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import {storiesOf} from '@storybook/react';
  3. import {action} from '@storybook/addon-actions';
  4. import {withInfo} from '@storybook/addon-info';
  5. import DetailedError from 'app/components/errors/detailedError';
  6. // eslint-disable-next-line
  7. storiesOf('UI|DetailedError', module)
  8. .add(
  9. 'default',
  10. withInfo('Displays a detailed error message')(() => (
  11. <DetailedError heading="Error heading" message="Error message" />
  12. ))
  13. )
  14. .add(
  15. 'with retry',
  16. withInfo(
  17. 'If `onRetry` callback is supplied, will show a "Retry" button in footer'
  18. )(() => (
  19. <DetailedError
  20. onRetry={action('onRetry')}
  21. heading="Error heading"
  22. message="Error message"
  23. />
  24. ))
  25. )
  26. .add(
  27. 'hides support links',
  28. withInfo('Hides support links')(() => (
  29. <DetailedError
  30. onRetry={action('onRetry')}
  31. hideSupportLinks
  32. heading="Error heading"
  33. message="Error message"
  34. />
  35. ))
  36. )
  37. .add(
  38. 'hides footer',
  39. withInfo('Hides footer if no support links or retry')(() => (
  40. <DetailedError hideSupportLinks heading="Error heading" message="Error message" />
  41. ))
  42. );