outline.stories.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import OutlinePane from '../js/features/outline/components/outline-pane'
  2. import { ContextRoot } from '../js/shared/context/root-context'
  3. import { setupContext } from './fixtures/context'
  4. setupContext()
  5. export const Basic = args => <OutlinePane {...args} />
  6. Basic.args = {
  7. outline: [{ line: 1, title: 'Hello', level: 1 }],
  8. }
  9. export const Nested = args => <OutlinePane {...args} />
  10. Nested.args = {
  11. outline: [
  12. {
  13. line: 1,
  14. title: 'Section',
  15. level: 1,
  16. children: [
  17. {
  18. line: 2,
  19. title: 'Subsection',
  20. level: 2,
  21. children: [
  22. {
  23. line: 3,
  24. title: 'Subsubsection',
  25. level: 3,
  26. },
  27. ],
  28. },
  29. ],
  30. },
  31. ],
  32. }
  33. export const NoSections = args => <OutlinePane {...args} />
  34. NoSections.args = {}
  35. export const NonTexFile = args => <OutlinePane {...args} />
  36. NonTexFile.args = {
  37. isTexFile: false,
  38. }
  39. export default {
  40. title: 'Outline',
  41. component: OutlinePane,
  42. argTypes: {
  43. jumpToLine: { action: 'jumpToLine' },
  44. },
  45. args: {
  46. eventTracking: { sendMB: () => {} },
  47. isTexFile: true,
  48. outline: [],
  49. jumpToLine: () => {},
  50. onToggle: () => {},
  51. },
  52. decorators: [
  53. Story => (
  54. <ContextRoot ide={window._ide} settings={{}}>
  55. <Story />
  56. </ContextRoot>
  57. ),
  58. ],
  59. }