aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/buttons
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/molecules/buttons
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/molecules/buttons')
-rw-r--r--src/components/molecules/buttons/back-to-top.stories.tsx17
-rw-r--r--src/components/molecules/buttons/heading-button.stories.tsx78
-rw-r--r--src/components/molecules/buttons/help-button.stories.tsx17
3 files changed, 96 insertions, 16 deletions
diff --git a/src/components/molecules/buttons/back-to-top.stories.tsx b/src/components/molecules/buttons/back-to-top.stories.tsx
index fe58293..7d4bc39 100644
--- a/src/components/molecules/buttons/back-to-top.stories.tsx
+++ b/src/components/molecules/buttons/back-to-top.stories.tsx
@@ -2,6 +2,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
import BackToTopComponent from './back-to-top';
+/**
+ * BackToTop - Storybook Meta
+ */
export default {
title: 'Molecules/Buttons',
component: BackToTopComponent,
@@ -30,14 +33,22 @@ export default {
},
},
},
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
} as ComponentMeta<typeof BackToTopComponent>;
const Template: ComponentStory<typeof BackToTopComponent> = (args) => (
- <IntlProvider locale="en">
- <BackToTopComponent {...args} />
- </IntlProvider>
+ <BackToTopComponent {...args} />
);
+/**
+ * Buttons Stories - Back to top
+ */
export const BackToTop = Template.bind({});
BackToTop.args = {
target: 'top',
diff --git a/src/components/molecules/buttons/heading-button.stories.tsx b/src/components/molecules/buttons/heading-button.stories.tsx
index 0a23b08..b0e1465 100644
--- a/src/components/molecules/buttons/heading-button.stories.tsx
+++ b/src/components/molecules/buttons/heading-button.stories.tsx
@@ -3,8 +3,11 @@ import { useState } from 'react';
import { IntlProvider } from 'react-intl';
import HeadingButtonComponent from './heading-button';
+/**
+ * HeadingButton - Storybook Meta
+ */
export default {
- title: 'Molecules/Buttons',
+ title: 'Molecules/Buttons/HeadingButton',
component: HeadingButtonComponent,
argTypes: {
expanded: {
@@ -20,6 +23,8 @@ export default {
level: {
control: {
type: 'number',
+ min: 1,
+ max: 6,
},
description: 'Heading level.',
type: {
@@ -48,6 +53,13 @@ export default {
},
},
},
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
} as ComponentMeta<typeof HeadingButtonComponent>;
const Template: ComponentStory<typeof HeadingButtonComponent> = ({
@@ -58,18 +70,64 @@ const Template: ComponentStory<typeof HeadingButtonComponent> = ({
const [isExpanded, setIsExpanded] = useState<boolean>(expanded);
return (
- <IntlProvider locale="en">
- <HeadingButtonComponent
- expanded={isExpanded}
- setExpanded={setIsExpanded}
- {...args}
- />
- </IntlProvider>
+ <HeadingButtonComponent
+ expanded={isExpanded}
+ setExpanded={setIsExpanded}
+ {...args}
+ />
);
};
-export const HeadingButton = Template.bind({});
-HeadingButton.args = {
+/**
+ * Heading Button Stories - Level 1
+ */
+export const Level1 = Template.bind({});
+Level1.args = {
+ level: 1,
+ title: 'Your title',
+};
+
+/**
+ * Heading Button Stories - Level 2
+ */
+export const Level2 = Template.bind({});
+Level2.args = {
level: 2,
title: 'Your title',
};
+
+/**
+ * Heading Button Stories - Level 3
+ */
+export const Level3 = Template.bind({});
+Level3.args = {
+ level: 3,
+ title: 'Your title',
+};
+
+/**
+ * Heading Button Stories - Level 4
+ */
+export const Level4 = Template.bind({});
+Level4.args = {
+ level: 4,
+ title: 'Your title',
+};
+
+/**
+ * Heading Button Stories - Level 5
+ */
+export const Level5 = Template.bind({});
+Level5.args = {
+ level: 5,
+ title: 'Your title',
+};
+
+/**
+ * Heading Button Stories - Level 6
+ */
+export const Level6 = Template.bind({});
+Level6.args = {
+ level: 6,
+ title: 'Your title',
+};
diff --git a/src/components/molecules/buttons/help-button.stories.tsx b/src/components/molecules/buttons/help-button.stories.tsx
index cfc1b0b..cfc603e 100644
--- a/src/components/molecules/buttons/help-button.stories.tsx
+++ b/src/components/molecules/buttons/help-button.stories.tsx
@@ -2,6 +2,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
import HelpButtonComponent from './help-button';
+/**
+ * HelpButton - Storybook Meta
+ */
export default {
title: 'Molecules/Buttons',
component: HelpButtonComponent,
@@ -33,12 +36,20 @@ export default {
},
},
},
+ decorators: [
+ (Story) => (
+ <IntlProvider locale="en">
+ <Story />
+ </IntlProvider>
+ ),
+ ],
} as ComponentMeta<typeof HelpButtonComponent>;
const Template: ComponentStory<typeof HelpButtonComponent> = (args) => (
- <IntlProvider locale="en">
- <HelpButtonComponent {...args} />
- </IntlProvider>
+ <HelpButtonComponent {...args} />
);
+/**
+ * Help Button Stories - Level 1
+ */
export const HelpButton = Template.bind({});