outline.stories.jsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import OutlinePane from '../js/features/outline/components/outline-pane'
  2. import { ScopeDecorator } from './decorators/scope'
  3. export const Basic = args => <OutlinePane {...args} />
  4. Basic.args = {
  5. outline: [{ line: 1, title: 'Hello', level: 1 }],
  6. }
  7. export const Nested = args => <OutlinePane {...args} />
  8. Nested.args = {
  9. outline: [
  10. {
  11. line: 1,
  12. title: 'Section',
  13. level: 1,
  14. children: [
  15. {
  16. line: 2,
  17. title: 'Subsection',
  18. level: 2,
  19. children: [
  20. {
  21. line: 3,
  22. title: 'Subsubsection',
  23. level: 3,
  24. },
  25. ],
  26. },
  27. ],
  28. },
  29. ],
  30. }
  31. export const NoSections = args => <OutlinePane {...args} />
  32. NoSections.args = {}
  33. export const NonTexFile = args => <OutlinePane {...args} />
  34. NonTexFile.args = {
  35. isTexFile: false,
  36. }
  37. export const PartialResult = args => <OutlinePane {...args} />
  38. PartialResult.args = {
  39. isPartial: true,
  40. }
  41. export default {
  42. title: 'Editor / Outline',
  43. component: OutlinePane,
  44. argTypes: {
  45. jumpToLine: { action: 'jumpToLine' },
  46. onToggle: { action: 'onToggle' },
  47. toggleExpanded: { action: 'toggleExpanded' },
  48. },
  49. args: {
  50. isTexFile: true,
  51. outline: [],
  52. expanded: true,
  53. },
  54. decorators: [ScopeDecorator],
  55. }