Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';
import { Loader2, Mail, Download } from 'lucide-react';
const meta = {
title: 'UI/Button',
component: Button,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
variant: {
control: 'select',
options: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
},
size: {
control: 'select',
options: ['default', 'sm', 'lg', 'icon'],
},
loading: {
control: 'boolean',
},
disabled: {
control: 'boolean',
},
asChild: {
control: 'boolean',
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
children: 'Button',
},
};
export const Destructive: Story = {
args: {
variant: 'destructive',
children: 'Delete',
},
};
export const Outline: Story = {
args: {
variant: 'outline',
children: 'Outline',
},
};
export const Secondary: Story = {
args: {
variant: 'secondary',
children: 'Secondary',
},
};
export const Ghost: Story = {
args: {
variant: 'ghost',
children: 'Ghost',
},
};
export const Link: Story = {
args: {
variant: 'link',
children: 'Link',
},
};
export const Small: Story = {
args: {
size: 'sm',
children: 'Small',
},
};
export const Large: Story = {
args: {
size: 'lg',
children: 'Large',
},
};
export const Icon: Story = {
args: {
size: 'icon',
children: <Mail className="h-4 w-4" />,
},
};
export const Loading: Story = {
args: {
loading: true,
children: 'Loading...',
},
};
export const Disabled: Story = {
args: {
disabled: true,
children: 'Disabled',
},
};
export const WithIcon: Story = {
args: {
children: (
<>
<Mail className="h-4 w-4" />
Login with Email
</>
),
},
};
export const LoadingWithIcon: Story = {
args: {
loading: true,
children: (
<>
<Download className="h-4 w-4" />
Downloading...
</>
),
},
};
export const AllVariants: Story = {
render: () => (
<div className="flex flex-col gap-4">
<div className="flex gap-2 flex-wrap">
<Button variant="default">Default</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="outline">Outline</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
</div>
<div className="flex gap-2 flex-wrap">
<Button size="sm">Small</Button>
<Button size="default">Default</Button>
<Button size="lg">Large</Button>
<Button size="icon">
<Mail className="h-4 w-4" />
</Button>
</div>
<div className="flex gap-2 flex-wrap">
<Button loading>Loading</Button>
<Button disabled>Disabled</Button>
<Button loading disabled>Loading & Disabled</Button>
</div>
</div>
),
}; |