soapbox/stories/Button.stories.tsx

49 wiersze
1.4 KiB
TypeScript
Czysty Zwykły widok Historia

2023-02-03 00:19:52 +00:00
import { ComponentStory, ComponentMeta } from '@storybook/react';
2023-02-03 02:23:47 +00:00
import React from 'react';
2023-02-03 00:19:52 +00:00
2023-02-03 05:00:51 +00:00
import { Button } from 'soapbox/components/ui';
2023-02-03 00:19:52 +00:00
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
2023-02-03 03:53:26 +00:00
title: 'UI/Button',
2023-02-03 00:19:52 +00:00
component: Button,
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
argTypes: {
2023-02-03 03:53:26 +00:00
text: { type: 'string', defaultValue: 'Button' },
2023-02-03 05:00:51 +00:00
theme: { defaultValue: 'primary' },
size: { defaultValue: 'md' },
disabled: { defaultValue: false },
block: { defaultValue: false },
children: { table: { disable: true } },
className: { table: { disable: true } },
type: { table: { disable: true } },
to: { table: { disable: true } },
icon: { table: { disable: true } },
onClick: { table: { disable: true } },
2023-02-03 00:19:52 +00:00
},
} as ComponentMeta<typeof Button>;
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
export const Primary = Template.bind({});
// More on args: https://storybook.js.org/docs/react/writing-stories/args
Primary.args = {
theme: 'primary',
2023-02-03 00:19:52 +00:00
};
export const Secondary = Template.bind({});
Secondary.args = {
2023-02-03 03:53:26 +00:00
theme: 'secondary',
2023-02-03 00:19:52 +00:00
};
export const Large = Template.bind({});
Large.args = {
size: 'lg',
2023-02-03 00:19:52 +00:00
};
export const Small = Template.bind({});
Small.args = {
size: 'sm',
2023-02-03 00:19:52 +00:00
};