Button strories lint

This commit is contained in:
Vivian Phung 2024-05-14 12:08:31 -04:00 committed by Vivian Phung
parent 7dcd6581a7
commit 090a9054e4
2 changed files with 77 additions and 0 deletions

View File

@ -1 +1,2 @@
export * from './Badge';
export * from './Badge.theme';

View File

@ -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<typeof Badge> = {
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<typeof Badge>;
export default meta;
type Story = StoryObj<typeof Badge>;
export const Default: Story = {
render: ({ variant, size, children, ...args }) => (
<Badge variant={variant} size={size} {...args}>
{children}
</Badge>
),
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) => (
<div className="flex gap-5" key={index}>
{badgeSizes.map((size) => (
<Badge key={variant} variant={variant} size={size}>
{size}
</Badge>
))}
{variant}
</div>
))}
</>
),
};