aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/forms
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-04-20 19:24:21 +0200
committerArmand Philippot <git@armandphilippot.com>2022-04-20 19:27:29 +0200
commita08291b1586858fc894a27d56f55f87a88f8dbd3 (patch)
tree0aa36c8add0ad0ecc07c0f7f20f5af3e2f7abe46 /src/components/organisms/forms
parent362cf45bc520a68a1c1be20e1189ca2307577dde (diff)
refactor(storybook): reorganize design system
Add more stories for each components and change some components categories for better organization.
Diffstat (limited to 'src/components/organisms/forms')
-rw-r--r--src/components/organisms/forms/comment-form.stories.tsx31
-rw-r--r--src/components/organisms/forms/contact-form.stories.tsx29
-rw-r--r--src/components/organisms/forms/search-form.stories.tsx46
3 files changed, 79 insertions, 27 deletions
diff --git a/src/components/organisms/forms/comment-form.stories.tsx b/src/components/organisms/forms/comment-form.stories.tsx
index 670176c..f66d35c 100644
--- a/src/components/organisms/forms/comment-form.stories.tsx
+++ b/src/components/organisms/forms/comment-form.stories.tsx
@@ -1,10 +1,13 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
-import CommentFormComponent from './comment-form';
+import CommentForm from './comment-form';
+/**
+ * CommentForm - Storybook Meta
+ */
export default {
title: 'Organisms/Forms',
- component: CommentFormComponent,
+ component: CommentForm,
argTypes: {
className: {
control: {
@@ -58,6 +61,8 @@ export default {
titleLevel: {
control: {
type: 'number',
+ min: 1,
+ max: 6,
},
description: 'The title level (hn).',
table: {
@@ -69,16 +74,24 @@ export default {
},
},
},
-} as ComponentMeta<typeof CommentFormComponent>;
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
+} as ComponentMeta<typeof CommentForm>;
-const Template: ComponentStory<typeof CommentFormComponent> = (args) => (
- <IntlProvider locale="en">
- <CommentFormComponent {...args} />
- </IntlProvider>
+const Template: ComponentStory<typeof CommentForm> = (args) => (
+ <CommentForm {...args} />
);
-export const CommentForm = Template.bind({});
-CommentForm.args = {
+/**
+ * Forms Stories - Comment
+ */
+export const Comment = Template.bind({});
+Comment.args = {
saveComment: (reset: () => void) => {
reset();
},
diff --git a/src/components/organisms/forms/contact-form.stories.tsx b/src/components/organisms/forms/contact-form.stories.tsx
index 2c8ab32..9b936f9 100644
--- a/src/components/organisms/forms/contact-form.stories.tsx
+++ b/src/components/organisms/forms/contact-form.stories.tsx
@@ -1,10 +1,13 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
-import ContactFormComponent from './contact-form';
+import ContactForm from './contact-form';
+/**
+ * ContactForm - Storybook Meta
+ */
export default {
title: 'Organisms/Forms',
- component: ContactFormComponent,
+ component: ContactForm,
argTypes: {
className: {
control: {
@@ -43,16 +46,24 @@ export default {
},
},
},
-} as ComponentMeta<typeof ContactFormComponent>;
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
+} as ComponentMeta<typeof ContactForm>;
-const Template: ComponentStory<typeof ContactFormComponent> = (args) => (
- <IntlProvider locale="en">
- <ContactFormComponent {...args} />
- </IntlProvider>
+const Template: ComponentStory<typeof ContactForm> = (args) => (
+ <ContactForm {...args} />
);
-export const ContactForm = Template.bind({});
-ContactForm.args = {
+/**
+ * Forms Stories - Contact
+ */
+export const Contact = Template.bind({});
+Contact.args = {
sendMail: (reset: () => void) => {
reset();
},
diff --git a/src/components/organisms/forms/search-form.stories.tsx b/src/components/organisms/forms/search-form.stories.tsx
index 4ec1c21..7f4c7c0 100644
--- a/src/components/organisms/forms/search-form.stories.tsx
+++ b/src/components/organisms/forms/search-form.stories.tsx
@@ -1,10 +1,16 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
-import SearchFormComponent from './search-form';
+import SearchForm from './search-form';
+/**
+ * SearchForm - Storybook Meta
+ */
export default {
title: 'Organisms/Forms',
- component: SearchFormComponent,
+ component: SearchForm,
+ args: {
+ hideLabel: false,
+ },
argTypes: {
className: {
control: {
@@ -19,16 +25,38 @@ export default {
required: false,
},
},
+ hideLabel: {
+ control: {
+ type: 'boolean',
+ },
+ description: 'Determine if the input label should be visually hidden.',
+ table: {
+ category: 'Options',
+ defaultValue: { summary: false },
+ },
+ type: {
+ name: 'boolean',
+ required: false,
+ },
+ },
},
-} as ComponentMeta<typeof SearchFormComponent>;
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
+} as ComponentMeta<typeof SearchForm>;
-const Template: ComponentStory<typeof SearchFormComponent> = (args) => (
- <IntlProvider locale="en">
- <SearchFormComponent {...args} />
- </IntlProvider>
+const Template: ComponentStory<typeof SearchForm> = (args) => (
+ <SearchForm {...args} />
);
-export const SearchForm = Template.bind({});
-SearchForm.args = {
+/**
+ * Forms Stories - Search
+ */
+export const Search = Template.bind({});
+Search.args = {
hideLabel: true,
};