mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 14:33:43 -05:00
4a8b79080b
* [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
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import ActionsMenu from '../../js/features/editor-left-menu/components/actions-menu'
|
|
import { ScopeDecorator } from '../decorators/scope'
|
|
import { mockCompile, mockCompileError } from '../fixtures/compile'
|
|
import { document, mockDocument } from '../fixtures/document'
|
|
import useFetchMock from '../hooks/use-fetch-mock'
|
|
import { useScope } from '../hooks/use-scope'
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
|
|
|
export default {
|
|
title: 'Editor / Left Menu / Actions Menu',
|
|
component: ActionsMenu,
|
|
argTypes: {
|
|
...bsVersionDecorator.argTypes,
|
|
},
|
|
decorators: [
|
|
(Story: any) => ScopeDecorator(Story, { mockCompileOnLoad: false }),
|
|
],
|
|
}
|
|
|
|
export const NotCompiled = () => {
|
|
window.metaAttributesCache.set('ol-anonymous', false)
|
|
|
|
useFetchMock(fetchMock => {
|
|
mockCompileError(fetchMock, 'failure')
|
|
})
|
|
|
|
return (
|
|
<div id="left-menu" className="shown">
|
|
<ActionsMenu />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const CompileSuccess = () => {
|
|
window.metaAttributesCache.set('ol-anonymous', false)
|
|
|
|
useScope({
|
|
editor: {
|
|
sharejs_doc: mockDocument(document.tex),
|
|
},
|
|
})
|
|
|
|
useFetchMock(fetchMock => {
|
|
mockCompile(fetchMock)
|
|
fetchMock.get('express:/project/:projectId/wordcount', {
|
|
texcount: {
|
|
encode: 'ascii',
|
|
textWords: 10,
|
|
headers: 11,
|
|
mathInline: 12,
|
|
mathDisplay: 13,
|
|
},
|
|
})
|
|
})
|
|
|
|
return (
|
|
<div id="left-menu" className="shown">
|
|
<ActionsMenu />
|
|
</div>
|
|
)
|
|
}
|