mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-14 22:00:55 -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
71 lines
2 KiB
JavaScript
71 lines
2 KiB
JavaScript
import FileTreeCreateNameInput from '../../../js/features/file-tree/components/file-tree-create/file-tree-create-name-input'
|
|
import FileTreeCreateNameProvider from '../../../js/features/file-tree/contexts/file-tree-create-name'
|
|
import {
|
|
BlockedFilenameError,
|
|
DuplicateFilenameError,
|
|
} from '../../../js/features/file-tree/errors'
|
|
import { ModalBodyDecorator, ModalContentDecorator } from '../modal-decorators'
|
|
import { bsVersionDecorator } from '../../../../.storybook/utils/with-bootstrap-switcher'
|
|
|
|
export const DefaultLabel = args => (
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
|
|
export const CustomLabel = args => (
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
CustomLabel.args = {
|
|
label: 'File Name in this Project',
|
|
}
|
|
|
|
export const FocusName = args => (
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
FocusName.args = {
|
|
focusName: true,
|
|
}
|
|
|
|
export const CustomPlaceholder = args => (
|
|
<FileTreeCreateNameProvider>
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
CustomPlaceholder.args = {
|
|
placeholder: 'Enter a file name…',
|
|
}
|
|
|
|
export const DuplicateError = args => (
|
|
<FileTreeCreateNameProvider initialName="main.tex">
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
DuplicateError.args = {
|
|
error: new DuplicateFilenameError(),
|
|
}
|
|
|
|
export const BlockedError = args => (
|
|
<FileTreeCreateNameProvider initialName="main.tex">
|
|
<FileTreeCreateNameInput {...args} />
|
|
</FileTreeCreateNameProvider>
|
|
)
|
|
BlockedError.args = {
|
|
error: new BlockedFilenameError(),
|
|
}
|
|
|
|
export default {
|
|
title: 'Editor / Modals / Create File / File Name Input',
|
|
component: FileTreeCreateNameInput,
|
|
decorators: [ModalBodyDecorator, ModalContentDecorator],
|
|
args: {
|
|
inFlight: false,
|
|
},
|
|
argTypes: {
|
|
...bsVersionDecorator.argTypes,
|
|
},
|
|
}
|