preview.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import 'focus-visible';
  2. import React from 'react';
  3. import {ThemeProvider} from 'emotion-theming';
  4. import {create} from '@storybook/theming/create';
  5. import {
  6. addParameters,
  7. configure,
  8. setAddon,
  9. getStorybook,
  10. addDecorator,
  11. } from '@storybook/react';
  12. import {withInfo} from '@storybook/addon-info';
  13. import {setOptions} from '@storybook/addon-options';
  14. import theme from '../src/sentry/static/sentry/app/utils/theme';
  15. import '../docs-ui/index.js';
  16. const withTheme = storyFn => <ThemeProvider theme={theme}>{storyFn()}</ThemeProvider>;
  17. addDecorator(withTheme);
  18. // Option defaults:
  19. addParameters({
  20. options: {
  21. /**
  22. * show story component as full screen
  23. * @type {Boolean}
  24. */
  25. isFullscreen: false,
  26. /**
  27. * display panel that shows a list of stories
  28. * @type {Boolean}
  29. */
  30. showNav: true,
  31. /**
  32. * display panel that shows addon configurations
  33. * @type {Boolean}
  34. */
  35. showPanel: true,
  36. /**
  37. * where to show the addon panel
  38. * @type {('bottom'|'right')}
  39. */
  40. panelPosition: 'bottom',
  41. /**
  42. * regex for finding the hierarchy separator
  43. * @example:
  44. * null - turn off hierarchy
  45. * /\// - split by `/`
  46. * /\./ - split by `.`
  47. * /\/|\./ - split by `/` or `.`
  48. * @type {Regex}
  49. */
  50. hierarchySeparator: /\/|\./,
  51. /**
  52. * regex for finding the hierarchy root separator
  53. * @example:
  54. * null - turn off multiple hierarchy roots
  55. * /\|/ - split by `|`
  56. * @type {Regex}
  57. */
  58. hierarchyRootSeparator: /\|/,
  59. /**
  60. * sidebar tree animat
  61. * ions
  62. * @type {Boolean}
  63. */
  64. sidebarAnimations: true,
  65. /**
  66. * enable/disable shortcuts
  67. * @type {Boolean}
  68. */
  69. enableShortcuts: true,
  70. /**
  71. * show/hide tool bar
  72. * @type {Boolean}
  73. */
  74. isToolshown: true,
  75. /**
  76. * function to sort stories in the tree view
  77. * common use is alphabetical `(a, b) => a[1].id.localeCompare(b[1].id)`
  78. * if left undefined, then the order in which the stories are imported will
  79. * be the order they display
  80. * @type {Function}
  81. */
  82. storySort: undefined,
  83. },
  84. });