From a6ff5eee45215effb3344cb5d631a27a7c0369aa Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 22 Sep 2023 19:34:01 +0200 Subject: refactor(components): rewrite form components --- .../forms/fields/text-area/text-area.stories.tsx | 136 +++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 src/components/atoms/forms/fields/text-area/text-area.stories.tsx (limited to 'src/components/atoms/forms/fields/text-area/text-area.stories.tsx') diff --git a/src/components/atoms/forms/fields/text-area/text-area.stories.tsx b/src/components/atoms/forms/fields/text-area/text-area.stories.tsx new file mode 100644 index 0000000..2e77cb7 --- /dev/null +++ b/src/components/atoms/forms/fields/text-area/text-area.stories.tsx @@ -0,0 +1,136 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import { ChangeEvent, useCallback, useState } from 'react'; +import { TextArea as TextAreaComponent } from './text-area'; + +/** + * TextArea - Storybook Meta + */ +export default { + title: 'Atoms/Forms/Fields', + component: TextAreaComponent, + args: { + isDisabled: false, + isRequired: false, + }, + argTypes: { + 'aria-labelledby': { + control: { + type: 'text', + }, + description: 'One or more ids that refers to the field name.', + table: { + category: 'Accessibility', + }, + type: { + name: 'string', + required: false, + }, + }, + className: { + control: { + type: 'text', + }, + description: 'Add classnames to the field.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, + id: { + control: { + type: 'text', + }, + description: 'TextArea id.', + type: { + name: 'string', + required: true, + }, + }, + isDisabled: { + control: { + type: 'boolean', + }, + description: 'TextArea state: either enabled or disabled.', + table: { + category: 'Options', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, + isRequired: { + control: { + type: 'boolean', + }, + description: 'Determine if the field is required.', + table: { + category: 'Options', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, + name: { + control: { + type: 'text', + }, + description: 'TextArea name.', + type: { + name: 'string', + required: true, + }, + }, + placeholder: { + control: { + type: 'text', + }, + description: 'A placeholder value.', + table: { + category: 'Options', + }, + type: { + name: 'string', + required: false, + }, + }, + value: { + control: { + type: null, + }, + description: 'TextArea value.', + type: { + name: 'string', + required: true, + }, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = ({ + value: initialValue, + onChange: _onChange, + ...args +}) => { + const [value, setValue] = useState(initialValue); + const updateValue = useCallback((e: ChangeEvent) => { + setValue(e.target.value); + }, []); + + return ; +}; + +/** + * TextArea Story - TextArea + */ +export const TextArea = Template.bind({}); +TextArea.args = { + id: 'field-storybook', + name: 'field-storybook', +}; -- cgit v1.2.3