diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-04-20 19:24:21 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-04-20 19:27:29 +0200 |
| commit | a08291b1586858fc894a27d56f55f87a88f8dbd3 (patch) | |
| tree | 0aa36c8add0ad0ecc07c0f7f20f5af3e2f7abe46 /src/components/atoms/layout | |
| parent | 362cf45bc520a68a1c1be20e1189ca2307577dde (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/atoms/layout')
| -rw-r--r-- | src/components/atoms/layout/copyright.stories.tsx | 17 | ||||
| -rw-r--r-- | src/components/atoms/layout/main.stories.tsx | 6 | ||||
| -rw-r--r-- | src/components/atoms/layout/no-script.stories.tsx | 32 | ||||
| -rw-r--r-- | src/components/atoms/layout/notice.stories.tsx | 39 | ||||
| -rw-r--r-- | src/components/atoms/layout/section.stories.tsx | 33 |
5 files changed, 105 insertions, 22 deletions
diff --git a/src/components/atoms/layout/copyright.stories.tsx b/src/components/atoms/layout/copyright.stories.tsx index 3b315fa..b988165 100644 --- a/src/components/atoms/layout/copyright.stories.tsx +++ b/src/components/atoms/layout/copyright.stories.tsx @@ -3,6 +3,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { IntlProvider } from 'react-intl'; import CopyrightComponent from './copyright'; +/** + * Copyright - Storybook Meta + */ export default { title: 'Atoms/Layout', component: CopyrightComponent, @@ -36,14 +39,22 @@ export default { }, }, }, + decorators: [ + (Story) => ( + <IntlProvider locale="en"> + <Story /> + </IntlProvider> + ), + ], } as ComponentMeta<typeof CopyrightComponent>; const Template: ComponentStory<typeof CopyrightComponent> = (args) => ( - <IntlProvider locale="en"> - <CopyrightComponent {...args} /> - </IntlProvider> + <CopyrightComponent {...args} /> ); +/** + * Layout Stories - Copyright + */ export const Copyright = Template.bind({}); Copyright.args = { dates: { diff --git a/src/components/atoms/layout/main.stories.tsx b/src/components/atoms/layout/main.stories.tsx index 64df890..5bde475 100644 --- a/src/components/atoms/layout/main.stories.tsx +++ b/src/components/atoms/layout/main.stories.tsx @@ -1,6 +1,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import MainComponent from './main'; +/** + * Main - Storybook Meta + */ export default { title: 'Atoms/Layout', component: MainComponent, @@ -45,6 +48,9 @@ const Template: ComponentStory<typeof MainComponent> = (args) => ( <MainComponent {...args} /> ); +/** + * Layout Stories - Main + */ export const Main = Template.bind({}); Main.args = { children: 'The main content.', diff --git a/src/components/atoms/layout/no-script.stories.tsx b/src/components/atoms/layout/no-script.stories.tsx index 474e2fb..22d2fea 100644 --- a/src/components/atoms/layout/no-script.stories.tsx +++ b/src/components/atoms/layout/no-script.stories.tsx @@ -1,9 +1,12 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import NoScriptComponent from './no-script'; +import NoScript from './no-script'; +/** + * NoScript - Storybook Meta + */ export default { - title: 'Atoms/Layout', - component: NoScriptComponent, + title: 'Atoms/Layout/NoScript', + component: NoScript, args: { position: 'initial', }, @@ -34,13 +37,26 @@ export default { }, }, }, -} as ComponentMeta<typeof NoScriptComponent>; +} as ComponentMeta<typeof NoScript>; -const Template: ComponentStory<typeof NoScriptComponent> = (args) => ( - <NoScriptComponent {...args} /> +const Template: ComponentStory<typeof NoScript> = (args) => ( + <NoScript {...args} /> ); -export const NoScript = Template.bind({}); -NoScript.args = { +/** + * NoScript Stories - Default + */ +export const Default = Template.bind({}); +Default.args = { message: 'A noscript only message.', + position: 'initial', +}; + +/** + * NoScript Stories - Top + */ +export const Top = Template.bind({}); +Top.args = { + message: 'A noscript only message.', + position: 'top', }; diff --git a/src/components/atoms/layout/notice.stories.tsx b/src/components/atoms/layout/notice.stories.tsx index 0555a2e..62f4cba 100644 --- a/src/components/atoms/layout/notice.stories.tsx +++ b/src/components/atoms/layout/notice.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import NoticeComponent from './notice'; +/** + * Notice - Storybook Meta + */ export default { - title: 'Atoms/Layout', + title: 'Atoms/Layout/Notice', component: NoticeComponent, argTypes: { kind: { @@ -33,8 +36,38 @@ const Template: ComponentStory<typeof NoticeComponent> = (args) => ( <NoticeComponent {...args} /> ); -export const Notice = Template.bind({}); -Notice.args = { +/** + * Notice stories - Error + */ +export const Error = Template.bind({}); +Error.args = { + kind: 'error', + message: 'Nisi provident sapiente.', +}; + +/** + * Notice stories - Info + */ +export const Info = Template.bind({}); +Info.args = { kind: 'info', message: 'Nisi provident sapiente.', }; + +/** + * Notice stories - Success + */ +export const Success = Template.bind({}); +Success.args = { + kind: 'success', + message: 'Nisi provident sapiente.', +}; + +/** + * Notice stories - Warning + */ +export const Warning = Template.bind({}); +Warning.args = { + kind: 'warning', + message: 'Nisi provident sapiente.', +}; diff --git a/src/components/atoms/layout/section.stories.tsx b/src/components/atoms/layout/section.stories.tsx index abbbeed..530b2a0 100644 --- a/src/components/atoms/layout/section.stories.tsx +++ b/src/components/atoms/layout/section.stories.tsx @@ -1,9 +1,12 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import SectionComponent from './section'; +import Section from './section'; +/** + * Section - Storybook Meta + */ export default { - title: 'Atoms/Layout', - component: SectionComponent, + title: 'Atoms/Layout/Section', + component: Section, args: { variant: 'dark', withBorder: true, @@ -72,14 +75,28 @@ export default { }, }, }, -} as ComponentMeta<typeof SectionComponent>; +} as ComponentMeta<typeof Section>; -const Template: ComponentStory<typeof SectionComponent> = (args) => ( - <SectionComponent {...args} /> +const Template: ComponentStory<typeof Section> = (args) => ( + <Section {...args} /> ); -export const Section = Template.bind({}); -Section.args = { +/** + * Section Stories - Light + */ +export const Light = Template.bind({}); +Light.args = { title: 'A title', content: 'The content.', + variant: 'light', +}; + +/** + * Section Stories - Dark + */ +export const Dark = Template.bind({}); +Dark.args = { + title: 'A title', + content: 'The content.', + variant: 'dark', }; |
