65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import type { Meta, StoryObj } from "@storybook/react";
|
|
import { Button } from "~/components/ui/button";
|
|
|
|
const meta: Meta<typeof Button> = {
|
|
title: "UI / Buttons / Button",
|
|
component: Button,
|
|
tags: ["autodocs"],
|
|
argTypes: {
|
|
variant: {
|
|
control: { type: "select" },
|
|
options: ["default", "destructive", "outline", "secondary", "ghost", "link"],
|
|
},
|
|
size: { control: { type: "inline-radio" }, options: ["xs", "sm", "default", "lg", "icon"] },
|
|
isLoading: { control: "boolean" },
|
|
disabled: { control: "boolean" },
|
|
},
|
|
args: {
|
|
variant: "default",
|
|
size: "default",
|
|
isLoading: false,
|
|
disabled: false,
|
|
children: "Save changes",
|
|
},
|
|
};
|
|
|
|
export default meta;
|
|
|
|
type Story = StoryObj<typeof Button>;
|
|
|
|
export const Primary: Story = {};
|
|
|
|
export const Destructive: Story = { args: { variant: "destructive", children: "Delete account" } };
|
|
|
|
export const Outline: Story = { args: { variant: "outline", children: "Cancel" } };
|
|
|
|
export const Secondary: Story = { args: { variant: "secondary", children: "Secondary action" } };
|
|
|
|
export const Ghost: Story = { args: { variant: "ghost", children: "Dismiss" } };
|
|
|
|
export const LinkLike: Story = { args: { variant: "link", children: "Read the docs" } };
|
|
|
|
export const Loading: Story = { args: { isLoading: true, children: "Saving" } };
|
|
|
|
export const Disabled: Story = { args: { disabled: true, children: "Unavailable" } };
|
|
|
|
export const Sizes: Story = {
|
|
render: (args) => (
|
|
<div style={{ display: "flex", gap: 12, alignItems: "center" }}>
|
|
<Button {...args} size="xs">
|
|
Extra small
|
|
</Button>
|
|
<Button {...args} size="sm">
|
|
Small
|
|
</Button>
|
|
<Button {...args} size="default">
|
|
Default
|
|
</Button>
|
|
<Button {...args} size="lg">
|
|
Large
|
|
</Button>
|
|
</div>
|
|
),
|
|
args: { children: undefined },
|
|
};
|