mirror of
https://github.com/snowball-tools/snowballtools-base.git
synced 2024-12-22 16:37:44 +00:00
Button strories lint
This commit is contained in:
parent
7dcd6581a7
commit
090a9054e4
@ -1 +1,2 @@
|
||||
export * from './Badge';
|
||||
export * from './Badge.theme';
|
||||
|
76
packages/frontend/src/stories/Components/Badge.stories.tsx
Normal file
76
packages/frontend/src/stories/Components/Badge.stories.tsx
Normal 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>
|
||||
))}
|
||||
</>
|
||||
),
|
||||
};
|
Loading…
Reference in New Issue
Block a user