aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/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/atoms/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/atoms/buttons')
-rw-r--r--src/components/atoms/buttons/button-link.stories.tsx46
-rw-r--r--src/components/atoms/buttons/button-link.tsx2
-rw-r--r--src/components/atoms/buttons/button.stories.tsx42
-rw-r--r--src/components/atoms/buttons/buttons.module.scss5
4 files changed, 74 insertions, 21 deletions
diff --git a/src/components/atoms/buttons/button-link.stories.tsx b/src/components/atoms/buttons/button-link.stories.tsx
index 92b7521..2e1c040 100644
--- a/src/components/atoms/buttons/button-link.stories.tsx
+++ b/src/components/atoms/buttons/button-link.stories.tsx
@@ -1,9 +1,15 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
-import ButtonLinkComponent from './button-link';
+import ButtonLink from './button-link';
+/**
+ * ButtonLink - Storybook Meta
+ */
export default {
- title: 'Atoms/Buttons',
- component: ButtonLinkComponent,
+ title: 'Atoms/Buttons/ButtonLink',
+ component: ButtonLink,
+ args: {
+ shape: 'rectangle',
+ },
argTypes: {
'aria-label': {
control: {
@@ -82,14 +88,38 @@ export default {
},
},
},
-} as ComponentMeta<typeof ButtonLinkComponent>;
+} as ComponentMeta<typeof ButtonLink>;
-const Template: ComponentStory<typeof ButtonLinkComponent> = (args) => (
- <ButtonLinkComponent {...args} />
+const Template: ComponentStory<typeof ButtonLink> = (args) => (
+ <ButtonLink {...args} />
);
-export const ButtonLink = Template.bind({});
-ButtonLink.args = {
+/**
+ * ButtonLink Story - Primary
+ */
+export const Primary = Template.bind({});
+Primary.args = {
+ children: 'Link',
+ kind: 'primary',
+ target: '#',
+};
+
+/**
+ * ButtonLink Story - Secondary
+ */
+export const Secondary = Template.bind({});
+Secondary.args = {
+ children: 'Link',
+ kind: 'secondary',
+ target: '#',
+};
+
+/**
+ * ButtonLink Story - Tertiary
+ */
+export const Tertiary = Template.bind({});
+Tertiary.args = {
children: 'Link',
+ kind: 'tertiary',
target: '#',
};
diff --git a/src/components/atoms/buttons/button-link.tsx b/src/components/atoms/buttons/button-link.tsx
index 906fa76..64e0afd 100644
--- a/src/components/atoms/buttons/button-link.tsx
+++ b/src/components/atoms/buttons/button-link.tsx
@@ -22,7 +22,7 @@ export type ButtonLinkProps = {
/**
* ButtonLink kind. Default: secondary.
*/
- kind?: 'primary' | 'secondary';
+ kind?: 'primary' | 'secondary' | 'tertiary';
/**
* ButtonLink shape. Default: rectangle.
*/
diff --git a/src/components/atoms/buttons/button.stories.tsx b/src/components/atoms/buttons/button.stories.tsx
index d47a1ea..6803706 100644
--- a/src/components/atoms/buttons/button.stories.tsx
+++ b/src/components/atoms/buttons/button.stories.tsx
@@ -1,12 +1,14 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
-import ButtonComponent from './button';
+import Button from './button';
+/**
+ * Button - Storybook Meta
+ */
export default {
- title: 'Atoms/Buttons',
- component: ButtonComponent,
+ title: 'Atoms/Buttons/Button',
+ component: Button,
args: {
disabled: false,
- kind: 'secondary',
type: 'button',
},
argTypes: {
@@ -119,9 +121,9 @@ export default {
},
},
},
-} as ComponentMeta<typeof ButtonComponent>;
+} as ComponentMeta<typeof Button>;
-const Template: ComponentStory<typeof ButtonComponent> = (args) => {
+const Template: ComponentStory<typeof Button> = (args) => {
const { children, type, ...props } = args;
const getBody = () => {
@@ -139,10 +141,32 @@ const Template: ComponentStory<typeof ButtonComponent> = (args) => {
};
return (
- <ButtonComponent type={type} {...props}>
+ <Button type={type} {...props}>
{getBody()}
- </ButtonComponent>
+ </Button>
);
};
-export const Button = Template.bind({});
+/**
+ * Button Story - Primary
+ */
+export const Primary = Template.bind({});
+Primary.args = {
+ kind: 'primary',
+};
+
+/**
+ * Button Story - Secondary
+ */
+export const Secondary = Template.bind({});
+Secondary.args = {
+ kind: 'secondary',
+};
+
+/**
+ * Button Story - Tertiary
+ */
+export const Tertiary = Template.bind({});
+Tertiary.args = {
+ kind: 'tertiary',
+};
diff --git a/src/components/atoms/buttons/buttons.module.scss b/src/components/atoms/buttons/buttons.module.scss
index 8e3e196..36c66b6 100644
--- a/src/components/atoms/buttons/buttons.module.scss
+++ b/src/components/atoms/buttons/buttons.module.scss
@@ -8,6 +8,7 @@
border-radius: fun.convert-px(5);
font-size: var(--font-size-md);
font-weight: 600;
+ text-decoration: none;
transition: all 0.3s ease-in-out 0s;
&--initial {
@@ -44,7 +45,6 @@
fun.convert-px(2) fun.convert-px(2) 0 fun.convert-px(3)
var(--color-primary-dark);
color: var(--color-fg-inverted);
- text-decoration: none;
text-shadow: fun.convert-px(2) fun.convert-px(2) 0 var(--color-shadow);
&:disabled {
@@ -91,7 +91,6 @@
fun.convert-px(3) fun.convert-px(4) fun.convert-px(5) fun.convert-px(-4)
var(--color-shadow);
color: var(--color-primary);
- text-decoration: underline transparent 0;
&:disabled {
border-color: var(--color-border-dark);
@@ -122,7 +121,7 @@
border-color: var(--color-primary-dark);
box-shadow: 0 0 0 0 var(--color-shadow);
color: var(--color-primary-dark);
- text-decoration: underline transparent 0;
+ text-decoration: none;
transform: scale(var(--scale-down, 0.94));
}
}