webapp/src/components/Editor/Editor.stories.tsx

65 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-09-15 23:41:48 +00:00
import { Meta, StoryObj } from 'storybook-solidjs'
2024-09-27 16:31:54 +00:00
import { EditorComponent } from './Editor'
2024-09-15 23:41:48 +00:00
const meta: Meta<typeof EditorComponent> = {
title: 'Components/Editor',
component: EditorComponent,
argTypes: {
2024-09-27 16:31:54 +00:00
content: {
2024-09-15 23:41:48 +00:00
control: 'text',
description: 'Initial content for the editor',
defaultValue: ''
},
2024-09-27 16:31:54 +00:00
limit: {
control: 'number',
description: 'Character limit for the editor',
defaultValue: 500
},
placeholder: {
control: 'text',
description: 'Placeholder text when the editor is empty',
defaultValue: 'Start typing here...'
},
2024-09-15 23:41:48 +00:00
onChange: {
2024-09-27 16:31:54 +00:00
action: 'changed',
2024-09-15 23:41:48 +00:00
description: 'Callback when the content changes'
}
}
}
export default meta
type Story = StoryObj<typeof EditorComponent>
export const Default: Story = {
args: {
2024-09-27 16:31:54 +00:00
content: '',
limit: 500,
placeholder: 'Start typing here...'
2024-09-15 23:41:48 +00:00
}
}
export const WithInitialContent: Story = {
args: {
2024-09-27 16:31:54 +00:00
content: 'This is some initial content',
limit: 500,
placeholder: 'Start typing here...'
}
}
export const WithCharacterLimit: Story = {
args: {
content: '',
limit: 50,
placeholder: 'You have a 50 character limit...'
}
}
export const WithCustomPlaceholder: Story = {
args: {
content: '',
limit: 500,
placeholder: 'Custom placeholder here...'
2024-09-15 23:41:48 +00:00
}
}