|
1
|
import type { Meta, StoryObj } from "@storybook/react" |
|
2
|
import * as React from "react" |
|
3
|
|
|
4
|
import { Keyboard } from "@medusajs/icons" |
|
5
|
import { Kbd } from "../kbd" |
|
6
|
import { Toast } from "./toast" |
|
7
|
|
|
8
|
const meta: Meta<typeof Toast> = { |
|
9
|
title: "Components/Toast", |
|
10
|
component: Toast, |
|
11
|
parameters: { |
|
12
|
layout: "centered", |
|
13
|
}, |
|
14
|
render: (args) => { |
|
15
|
return <Toast {...args} /> |
|
16
|
}, |
|
17
|
} |
|
18
|
|
|
19
|
export default meta |
|
20
|
|
|
21
|
type Story = StoryObj<typeof Toast> |
|
22
|
|
|
23
|
export const Information: Story = { |
|
24
|
args: { |
|
25
|
title: "Label", |
|
26
|
description: "The quick brown fox jumps over a lazy dog.", |
|
27
|
variant: "info", |
|
28
|
}, |
|
29
|
} |
|
30
|
|
|
31
|
export const Warning: Story = { |
|
32
|
args: { |
|
33
|
title: "Label", |
|
34
|
description: "The quick brown fox jumps over a lazy dog.", |
|
35
|
variant: "warning", |
|
36
|
}, |
|
37
|
} |
|
38
|
|
|
39
|
export const Error: Story = { |
|
40
|
args: { |
|
41
|
title: "Label", |
|
42
|
description: "The quick brown fox jumps over a lazy dog.", |
|
43
|
variant: "error", |
|
44
|
}, |
|
45
|
} |
|
46
|
|
|
47
|
export const Success: Story = { |
|
48
|
args: { |
|
49
|
title: "Label", |
|
50
|
description: "The quick brown fox jumps over a lazy dog.", |
|
51
|
variant: "success", |
|
52
|
}, |
|
53
|
} |
|
54
|
|
|
55
|
export const Loading: Story = { |
|
56
|
args: { |
|
57
|
title: "Label", |
|
58
|
description: "The quick brown fox jumps over a lazy dog.", |
|
59
|
variant: "loading", |
|
60
|
}, |
|
61
|
} |
|
62
|
|
|
63
|
export const Message: Story = { |
|
64
|
args: { |
|
65
|
title: <span>Next time hit <Kbd>G</Kbd> then <Kbd>O</Kbd> to go to orders.</span>, |
|
66
|
icon: <Keyboard className="text-ui-fg-subtle" />, |
|
67
|
} |
|
68
|
} |
|
69
|
|
|
70
|
export const WithAction: Story = { |
|
71
|
args: { |
|
72
|
title: "Scheduled meeting", |
|
73
|
description: "The meeting has been added to your calendar.", |
|
74
|
variant: "success", |
|
75
|
action: { |
|
76
|
altText: "Undo adding meeting to calendar", |
|
77
|
onClick: () => {}, |
|
78
|
label: "Undo", |
|
79
|
}, |
|
80
|
}, |
|
81
|
} |
|
82
|
|
|
83
|
export const NoDescription: Story = { |
|
84
|
args: { |
|
85
|
title: "Label", |
|
86
|
variant: "info", |
|
87
|
}, |
|
88
|
} |