From 090a9054e4a171fa72a3337c2e27b6f16c0bf73a Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Tue, 14 May 2024 12:08:31 -0400 Subject: [PATCH] Button strories lint --- .../src/components/shared/Badge/index.ts | 1 + .../src/stories/Components/Badge.stories.tsx | 76 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 packages/frontend/src/stories/Components/Badge.stories.tsx diff --git a/packages/frontend/src/components/shared/Badge/index.ts b/packages/frontend/src/components/shared/Badge/index.ts index 9c8edca2..0c6caa07 100644 --- a/packages/frontend/src/components/shared/Badge/index.ts +++ b/packages/frontend/src/components/shared/Badge/index.ts @@ -1 +1,2 @@ export * from './Badge'; +export * from './Badge.theme'; diff --git a/packages/frontend/src/stories/Components/Badge.stories.tsx b/packages/frontend/src/stories/Components/Badge.stories.tsx new file mode 100644 index 00000000..36cdb617 --- /dev/null +++ b/packages/frontend/src/stories/Components/Badge.stories.tsx @@ -0,0 +1,76 @@ +import { Meta, StoryObj } from '@storybook/react'; + +import { Badge, BadgeTheme } from 'components/shared/Badge'; + +const badgeVariants: BadgeTheme['variant'][] = [ + 'primary', + 'secondary', + 'tertiary', + 'inset', +]; +const badgeSizes: BadgeTheme['size'][] = ['xs', 'sm']; + +const meta: Meta = { + title: 'Components/Badge', + component: Badge, + tags: ['autodocs'], + argTypes: { + variant: { + control: 'select', + options: badgeVariants, + }, + size: { + control: 'select', + options: badgeSizes, + }, + children: { + control: 'object', + }, + }, + args: { + variant: 'primary', + size: 'sm', + children: '1', + }, +} as Meta; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + render: ({ variant, size, children, ...args }) => ( + + {children} + + ), + args: { + variant: 'primary', + size: 'sm', + children: '1', + }, +}; + +export const Primary: Story = { + args: { + ...Default.args, + children: '1', + }, +}; + +export const All: Story = { + render: () => ( + <> + {badgeVariants.map((variant, index) => ( +
+ {badgeSizes.map((size) => ( + + {size} + + ))} + {variant} +
+ ))} + + ), +};