-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.stories.tsx
More file actions
188 lines (173 loc) · 5.02 KB
/
index.stories.tsx
File metadata and controls
188 lines (173 loc) · 5.02 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import { ExclamationCircleIcon } from '@heroicons/react/24/solid';
import AlertBox from '#ui/Common/AlertBox';
import type { Meta as MetaObj, StoryObj } from '@storybook/react-webpack5';
type Story = StoryObj<typeof AlertBox>;
type Meta = MetaObj<typeof AlertBox>;
const withMain = (args: React.ComponentProps<typeof AlertBox>) => (
<main>
<AlertBox {...args} />
</main>
);
export const Info: Story = {
args: {
level: 'info',
title: '3',
children:
'Legacy. Although this feature is unlikely to be removed and is still covered by semantic versioning guarantees, it is no longer actively maintained, and other alternatives are available.',
size: 'default',
},
};
export const Success: Story = {
args: {
level: 'success',
title: '2',
children:
'Stable. Compatibility with the npm ecosystem is a high priority.',
size: 'default',
},
};
export const Warning: Story = {
args: {
level: 'warning',
title: '1',
children:
'Experimental. The feature is not subject to semantic versioning rules. Non-backward compatible changes or removal may occur in any future release. Use of the feature is not recommended in production environments. Experimental features are subdivided into stages:',
size: 'default',
},
};
export const Danger: Story = {
args: {
level: 'danger',
title: '0',
children:
'Deprecated. The feature may emit warnings. Backward compatibility is not guaranteed.',
size: 'default',
},
};
export const Neutral: Story = {
args: {
level: 'neutral',
title: 'Note',
children:
"This is a neutral informational message that doesn't fit into the other alert categories.",
size: 'default',
},
};
export const InMarkdown: Story = {
args: {
level: 'danger',
title: '0',
children: (
<>
In a markdown component, <code>Code renders correctly,</code>{' '}
<a href="#">
<code>even when in a link</code>
</a>
</>
),
size: 'default',
},
render: withMain,
};
export const WithIcon: Story = {
args: {
level: 'info',
title: '3',
children: (
<p>
Lorem ipsum dolor sit amet <ExclamationCircleIcon /> consectetur
adipisicing elit. Inventore, quasi doloremque. Totam, earum velit, sunt
voluptates fugiat beatae praesentium quis magni explicabo repudiandae
nam aut molestias ex ad sequi eum!
</p>
),
size: 'default',
},
};
export const NoTitle: Story = {
args: {
level: 'info',
children: (
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore,
quasi doloremque. Totam, earum velit, sunt voluptates fugiat beatae
praesentium quis magni explicabo repudiandae nam aut molestias ex ad
sequi eum!
</p>
),
size: 'default',
},
};
export const SmallContainer: Story = {
render: args => (
<div className="w-200">
<AlertBox {...args} />
</div>
),
args: {
level: 'info',
title: 'Stability: 3',
children: (
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore,
quasi doloremque. Totam, earum velit, sunt voluptates fugiat beatae
praesentium quis magni explicabo repudiandae nam aut molestias ex ad
sequi eum!
</p>
),
size: 'default',
},
};
export const WithLongContent: Story = {
args: {
level: 'warning',
title: 'Stability: 1',
children: (
<span>
Experimental. Please migrate away from this API, if you can. We do not
recommend using the{' '}
<a href="#async_hookscreatehookcallbacks">
<code>createHook</code>
</a>
,{' '}
<a href="#class-asynchook">
<code>AsyncHook</code>
</a>
, and
<a href="#async_hooksexecutionasyncresource">
<code>executionAsyncResource</code>
</a>{' '}
APIs as they have usability issues, safety risks, and performance
implications. Async context tracking use cases are better served by the
stable{' '}
<a href="async_context.html#class-asynclocalstorage">
<code>AsyncLocalStorage</code>
</a>{' '}
API. If you have a use case for
<code>createHook</code>, <code>AsyncHook</code>, or{' '}
<code>executionAsyncResource</code> beyond the context tracking need
solved by{' '}
<a href="async_context.html#class-asynclocalstorage">
<code>AsyncLocalStorage</code>
</a>{' '}
or diagnostics data currently provided by{' '}
<a href="diagnostics_channel.html">Diagnostics Channel</a>, please open
an issue at{' '}
<a href="https://github.com/nodejs/node/issues">
https://github.com/nodejs/node/issues
</a>{' '}
describing your use case so we can create a more purpose-focused API.
</span>
),
size: 'default',
},
};
export default {
component: AlertBox,
argTypes: {
size: {
options: ['default', 'small'],
control: { type: 'radio' },
},
},
} as Meta;