2021-03-18 09:52:36 +00:00
|
|
|
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,
|
2021-04-27 07:52:58 +00:00
|
|
|
DuplicateFilenameError,
|
2021-03-18 09:52:36 +00:00
|
|
|
} from '../../../js/features/file-tree/errors'
|
|
|
|
import { ModalBodyDecorator, ModalContentDecorator } from '../modal-decorators'
|
|
|
|
|
|
|
|
export const DefaultLabel = args => (
|
|
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
|
|
|
|
export const CustomLabel = args => (
|
|
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
CustomLabel.args = {
|
2021-04-27 07:52:58 +00:00
|
|
|
label: 'File Name in this Project',
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const FocusName = args => (
|
|
|
|
<FileTreeCreateNameProvider initialName="example.tex">
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
FocusName.args = {
|
2021-04-27 07:52:58 +00:00
|
|
|
focusName: true,
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const CustomPlaceholder = args => (
|
|
|
|
<FileTreeCreateNameProvider>
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
CustomPlaceholder.args = {
|
2021-04-27 07:52:58 +00:00
|
|
|
placeholder: 'Enter a file name…',
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const DuplicateError = args => (
|
|
|
|
<FileTreeCreateNameProvider initialName="main.tex">
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
DuplicateError.args = {
|
2021-04-27 07:52:58 +00:00
|
|
|
error: new DuplicateFilenameError(),
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const BlockedError = args => (
|
|
|
|
<FileTreeCreateNameProvider initialName="main.tex">
|
|
|
|
<FileTreeCreateNameInput {...args} />
|
|
|
|
</FileTreeCreateNameProvider>
|
|
|
|
)
|
|
|
|
BlockedError.args = {
|
2021-04-27 07:52:58 +00:00
|
|
|
error: new BlockedFilenameError(),
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Modals / Create File / File Name Input',
|
|
|
|
component: FileTreeCreateNameInput,
|
2021-04-27 07:52:58 +00:00
|
|
|
decorators: [ModalBodyDecorator, ModalContentDecorator],
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|