overleaf/services/web/frontend/stories/outline.stories.jsx
Antoine Clausse 4a8b79080b [storybook] Update Storybook and add a control for BS3/BS5 (#20948)
* [storybook] Update Storybook to version 8.3.5

* [storybook] Run storybook with `--no-open`. Fixes xdg-utils issue

* [storybook] Create decorator for BS3/BS5

* [storybook] Add `bsVersionDecorator` to stories

* [storybook] Fix bugs in stories

* [storybook] Fixup `useMeta` type. Use `DeepPartial`

* [storybook] Fix types

GitOrigin-RevId: 48c0f0fefb1ab2d4863ab59051b900b1908a613c
2024-10-14 11:07:40 +00:00

63 lines
1.4 KiB
JavaScript

import OutlinePane from '../js/features/outline/components/outline-pane'
import { ScopeDecorator } from './decorators/scope'
import { bsVersionDecorator } from '../../.storybook/utils/with-bootstrap-switcher'
export const Basic = args => <OutlinePane {...args} />
Basic.args = {
outline: [{ line: 1, title: 'Hello', level: 1 }],
}
export const Nested = args => <OutlinePane {...args} />
Nested.args = {
outline: [
{
line: 1,
title: 'Section',
level: 1,
children: [
{
line: 2,
title: 'Subsection',
level: 2,
children: [
{
line: 3,
title: 'Subsubsection',
level: 3,
},
],
},
],
},
],
}
export const NoSections = args => <OutlinePane {...args} />
NoSections.args = {}
export const NonTexFile = args => <OutlinePane {...args} />
NonTexFile.args = {
isTexFile: false,
}
export const PartialResult = args => <OutlinePane {...args} />
PartialResult.args = {
isPartial: true,
}
export default {
title: 'Editor / Outline',
component: OutlinePane,
argTypes: {
jumpToLine: { action: 'jumpToLine' },
onToggle: { action: 'onToggle' },
toggleExpanded: { action: 'toggleExpanded' },
...bsVersionDecorator.argTypes,
},
args: {
isTexFile: true,
outline: [],
expanded: true,
},
decorators: [ScopeDecorator],
}