1 import type { Meta, StoryObj } from "@storybook/react"
2 import * as React from "react"
3
4 import { Alert } from "./alert"
5
6 const meta: Meta<typeof Alert> = {
7 title: "Components/Alert",
8 component: Alert,
9 argTypes: {
10 variant: {
11 control: {
12 type: "select",
13 options: ["info", "error", "success", "warning"],
14 },
15 },
16 dismissible: {
17 control: {
18 type: "boolean",
19 },
20 },
21 },
22 parameters: {
23 layout: "centered",
24 },
25 }
26
27 export default meta
28
29 type Story = StoryObj<typeof Alert>
30
31 const Text =
32 "We have sent you an email with instructions on how to reset your password. If you don't receive an email, please check your spam folder or try again."
33
34 export const Info: Story = {
35 args: {
36 variant: "info",
37 children: Text,
38 },
39 render: (args) => (
40 <div className="max-w-[300px]">
41 <Alert {...args} />
42 </div>
43 ),
44 }
45
46 export const Error: Story = {
47 args: {
48 variant: "error",
49 children: Text,
50 },
51 render: (args) => (
52 <div className="max-w-[300px]">
53 <Alert {...args} />
54 </div>
55 ),
56 }
57
58 export const Success: Story = {
59 args: {
60 variant: "success",
61 children: Text,
62 },
63 render: (args) => (
64 <div className="max-w-[300px]">
65 <Alert {...args} />
66 </div>
67 ),
68 }
69
70 export const Warning: Story = {
71 args: {
72 variant: "warning",
73 children: Text,
74 },
75 render: (args) => (
76 <div className="max-w-[300px]">
77 <Alert {...args} />
78 </div>
79 ),
80 }
81
82 export const Dismissible: Story = {
83 args: {
84 dismissible: true,
85 children: Text,
86 },
87 render: (args) => (
88 <div className="max-w-[300px]">
89 <Alert {...args} />
90 </div>
91 ),
92 }