Bin
2025-12-17 dcf780a91c16b6be28635b6e2e0e702060ee19f2
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
import type { Meta, StoryObj } from "@storybook/react";
import { Toast, type ToastProps, ToastType, ToastProvider, ToastViewport } from "./toast";
 
const ToastStory = (props: ToastProps) => {
  return (
    <ToastProvider type={ToastType.info}>
      <Toast {...props} open={true} />
      <div className="h-[140px] w-full flex items-center justify-center">
        <ToastViewport />
      </div>
    </ToastProvider>
  );
};
 
const meta: Meta<typeof Toast> = {
  title: "UI/Toast",
  component: ToastStory,
  argTypes: {
    type: {
      control: {
        type: "select",
        options: ["info", "error", "warning"],
      },
    },
    children: {
      control: "text",
    },
    duration: {
      control: "number",
    },
  },
};
 
export default meta;
 
type Story = StoryObj<typeof Toast>;
 
export const Info: Story = {
  args: {
    type: ToastType.info,
    children: "This is an informational message.",
    duration: 3000,
  },
};
 
export const Error: Story = {
  args: {
    type: ToastType.error,
    children: "Something went wrong.",
    duration: 3000,
  },
};
 
export const AlertError: Story = {
  args: {
    type: ToastType.alertError,
    children: "This is an alertError toast.",
    duration: 3000,
  },
};