@xyd-js/storybook 0.0.0-build
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +40 -0
- package/.storybook/manager-head.html +6 -0
- package/.storybook/manager.ts +18 -0
- package/.storybook/preview.ts +40 -0
- package/.storybook/styles.css +5 -0
- package/.storybook/theme.ts +34 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/eslint.config.js +28 -0
- package/package.json +61 -0
- package/public/logo.svg +10 -0
- package/src/__fixtures__/Icons.tsx +83 -0
- package/src/__fixtures__/atlas-index/package-index.mdx +194 -0
- package/src/__fixtures__/atlas-index/wip1.mdx +131 -0
- package/src/__fixtures__/atlas-index.mdx +53 -0
- package/src/__fixtures__/code-sample.mdx +15 -0
- package/src/__fixtures__/example-source-uniform.ts +41 -0
- package/src/__fixtures__/hello-world.mdx +116 -0
- package/src/components/DemoDocs.tsx +235 -0
- package/src/components/logo.tsx +37 -0
- package/src/decorators/DocsTemplate.tsx +101 -0
- package/src/docs/atlas/Atlas.stories.tsx +51 -0
- package/src/docs/atlas/todo-app.uniform.json +625 -0
- package/src/docs/atlas/uniform-to-references.ts +101 -0
- package/src/docs/components/coder/CodeSample.stories.tsx +29 -0
- package/src/docs/components/pages/PageBlogHome.stories.tsx +52 -0
- package/src/docs/components/pages/PageFirstSlide.stories.tsx +124 -0
- package/src/docs/components/pages/PageHome.stories.tsx +127 -0
- package/src/docs/components/system/Baseline.stories.tsx +126 -0
- package/src/docs/components/writer/Badge.stories.tsx +132 -0
- package/src/docs/components/writer/Banner.stories.tsx +394 -0
- package/src/docs/components/writer/Blockquote.stories.tsx +415 -0
- package/src/docs/components/writer/Breadcrumbs.stories.tsx +282 -0
- package/src/docs/components/writer/Button.stories.tsx +405 -0
- package/src/docs/components/writer/Callout.stories.tsx +183 -0
- package/src/docs/components/writer/Card.stories.tsx +457 -0
- package/src/docs/components/writer/ColorSchemeButton.stories.tsx +322 -0
- package/src/docs/components/writer/Details.stories.tsx +333 -0
- package/src/docs/components/writer/GuideCard.stories.tsx +384 -0
- package/src/docs/components/writer/Heading.stories.tsx +379 -0
- package/src/docs/components/writer/Hr.stories.tsx +325 -0
- package/src/docs/components/writer/IconSocial.stories.tsx +591 -0
- package/src/docs/components/writer/Image.stories.tsx +430 -0
- package/src/docs/components/writer/List.stories.tsx +479 -0
- package/src/docs/components/writer/NavLinks.stories.tsx +380 -0
- package/src/docs/components/writer/Pre.stories.tsx +23 -0
- package/src/docs/components/writer/Steps.stories.tsx +914 -0
- package/src/docs/components/writer/Table.stories.tsx +608 -0
- package/src/docs/components/writer/Tabs.stories.tsx +760 -0
- package/src/docs/components/writer/TocCard.stories.tsx +407 -0
- package/src/docs/components/writer/Update.stories.tsx +457 -0
- package/src/docs/components/writer/VideoGuide.stories.tsx +17 -0
- package/src/docs/templates/CodeSample.stories.tsx +15 -0
- package/src/docs/themes/TODO.md +1 -0
- package/src/docs/themes/logo.tsx +37 -0
- package/src/docs/themes/themes.stories.tsx +269 -0
- package/src/docs/ui/Nav.stories.tsx +58 -0
- package/src/docs/ui/Sidebar.stories.tsx +167 -0
- package/src/docs/ui/SubNav.stories.tsx +29 -0
- package/src/utils/mdx.ts +31 -0
- package/tsconfig.json +39 -0
- package/vite.config.ts +8 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@xyd-js/components/writer';
|
|
5
|
+
import {
|
|
6
|
+
IconSessionReplay,
|
|
7
|
+
IconMetrics,
|
|
8
|
+
IconFunnels
|
|
9
|
+
} from '../../../__fixtures__/Icons';
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof Button> = {
|
|
12
|
+
title: 'Components/Writer/Button',
|
|
13
|
+
component: Button,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: 'Button component provides interactive elements with various styles, sizes, and states. Supports icons, links, and different visual themes.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
children: {
|
|
23
|
+
description: 'The content to display inside the button',
|
|
24
|
+
control: 'text',
|
|
25
|
+
},
|
|
26
|
+
kind: {
|
|
27
|
+
description: 'The visual style variant of the button',
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
options: ['primary', 'secondary', 'tertiary'],
|
|
30
|
+
},
|
|
31
|
+
theme: {
|
|
32
|
+
description: 'The theme variant of the button',
|
|
33
|
+
control: { type: 'select' },
|
|
34
|
+
options: ['ghost'],
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
description: 'The size of the button',
|
|
38
|
+
control: { type: 'select' },
|
|
39
|
+
options: ['xs', 'sm', 'md', 'lg'],
|
|
40
|
+
},
|
|
41
|
+
className: {
|
|
42
|
+
description: 'Additional CSS class name',
|
|
43
|
+
control: 'text',
|
|
44
|
+
},
|
|
45
|
+
onClick: {
|
|
46
|
+
description: 'Click event handler',
|
|
47
|
+
control: false,
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
description: 'Whether the button is disabled',
|
|
51
|
+
control: 'boolean',
|
|
52
|
+
},
|
|
53
|
+
icon: {
|
|
54
|
+
description: 'Icon to display in the button',
|
|
55
|
+
control: false,
|
|
56
|
+
},
|
|
57
|
+
iconPosition: {
|
|
58
|
+
description: 'Position of the icon relative to the text',
|
|
59
|
+
control: { type: 'select' },
|
|
60
|
+
options: ['left', 'right'],
|
|
61
|
+
},
|
|
62
|
+
href: {
|
|
63
|
+
description: 'URL to navigate to (renders as anchor tag)',
|
|
64
|
+
control: 'text',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
70
|
+
type Story = StoryObj<typeof Button>;
|
|
71
|
+
|
|
72
|
+
// Basic usage
|
|
73
|
+
export const Default: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
children: 'Button',
|
|
76
|
+
kind: 'primary',
|
|
77
|
+
size: 'md',
|
|
78
|
+
},
|
|
79
|
+
render: (args) => (
|
|
80
|
+
<div style={{ padding: '20px' }}>
|
|
81
|
+
<Button {...args} />
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// All button kinds
|
|
87
|
+
export const AllKinds: Story = {
|
|
88
|
+
render: () => (
|
|
89
|
+
<div style={{ padding: '20px' }}>
|
|
90
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
91
|
+
<Button kind="primary">Primary</Button>
|
|
92
|
+
<Button kind="secondary">Secondary</Button>
|
|
93
|
+
<Button kind="tertiary">Tertiary</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// All sizes
|
|
100
|
+
export const AllSizes: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<div style={{ padding: '20px' }}>
|
|
103
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
104
|
+
<Button size="xs">Extra Small</Button>
|
|
105
|
+
<Button size="sm">Small</Button>
|
|
106
|
+
<Button size="md">Medium</Button>
|
|
107
|
+
<Button size="lg">Large</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// With icons
|
|
114
|
+
export const WithIcons: Story = {
|
|
115
|
+
render: () => (
|
|
116
|
+
<div style={{ padding: '20px' }}>
|
|
117
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
118
|
+
<Button icon={<IconSessionReplay />} iconPosition="left">
|
|
119
|
+
Play Video
|
|
120
|
+
</Button>
|
|
121
|
+
<Button icon={<IconMetrics />} iconPosition="right">
|
|
122
|
+
View Analytics
|
|
123
|
+
</Button>
|
|
124
|
+
<Button icon={<IconFunnels />} iconPosition="left">
|
|
125
|
+
Funnel Analysis
|
|
126
|
+
</Button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
),
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Icon only buttons
|
|
133
|
+
export const IconOnly: Story = {
|
|
134
|
+
render: () => (
|
|
135
|
+
<div style={{ padding: '20px' }}>
|
|
136
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
137
|
+
<Button icon={<IconSessionReplay />} />
|
|
138
|
+
<Button icon={<IconMetrics />} />
|
|
139
|
+
<Button icon={<IconFunnels />} />
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
),
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Ghost theme
|
|
146
|
+
export const GhostTheme: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<div style={{ padding: '20px' }}>
|
|
149
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
150
|
+
<Button theme="ghost" icon={<IconSessionReplay />} />
|
|
151
|
+
<Button theme="ghost" icon={<IconMetrics />} />
|
|
152
|
+
<Button theme="ghost" icon={<IconFunnels />} />
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Disabled state
|
|
159
|
+
export const Disabled: Story = {
|
|
160
|
+
render: () => (
|
|
161
|
+
<div style={{ padding: '20px' }}>
|
|
162
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
163
|
+
<Button disabled>Disabled Primary</Button>
|
|
164
|
+
<Button kind="secondary" disabled>Disabled Secondary</Button>
|
|
165
|
+
<Button kind="tertiary" disabled>Disabled Tertiary</Button>
|
|
166
|
+
<Button disabled icon={<IconSessionReplay />}>
|
|
167
|
+
Disabled with Icon
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
),
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Link buttons
|
|
175
|
+
export const LinkButtons: Story = {
|
|
176
|
+
render: () => (
|
|
177
|
+
<div style={{ padding: '20px' }}>
|
|
178
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
179
|
+
<Button href="/docs/getting-started">
|
|
180
|
+
Get Started
|
|
181
|
+
</Button>
|
|
182
|
+
<Button href="https://github.com" kind="secondary">
|
|
183
|
+
View on GitHub
|
|
184
|
+
</Button>
|
|
185
|
+
<Button href="/api" kind="tertiary" icon={<IconMetrics />}>
|
|
186
|
+
API Reference
|
|
187
|
+
</Button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
),
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Interactive example
|
|
194
|
+
export const Interactive: Story = {
|
|
195
|
+
args: {
|
|
196
|
+
children: 'Click Me!',
|
|
197
|
+
kind: 'primary',
|
|
198
|
+
size: 'md',
|
|
199
|
+
},
|
|
200
|
+
render: (args) => (
|
|
201
|
+
<div style={{ padding: '20px' }}>
|
|
202
|
+
<Button {...args} onClick={() => alert('Button clicked!')} />
|
|
203
|
+
<p style={{ marginTop: '10px', fontSize: '14px', color: '#666' }}>
|
|
204
|
+
Try clicking the button above to see the interactive behavior.
|
|
205
|
+
</p>
|
|
206
|
+
</div>
|
|
207
|
+
),
|
|
208
|
+
parameters: {
|
|
209
|
+
docs: {
|
|
210
|
+
description: {
|
|
211
|
+
story: 'This button demonstrates interactive behavior. Click it to see the onClick handler in action.',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// All combinations showcase
|
|
218
|
+
export const AllCombinations: Story = {
|
|
219
|
+
render: () => (
|
|
220
|
+
<div style={{ padding: '20px' }}>
|
|
221
|
+
<div style={{ marginBottom: '30px' }}>
|
|
222
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Primary Buttons</h3>
|
|
223
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
224
|
+
<Button size="xs">XS Primary</Button>
|
|
225
|
+
<Button size="sm">Small Primary</Button>
|
|
226
|
+
<Button size="md">Medium Primary</Button>
|
|
227
|
+
<Button size="lg">Large Primary</Button>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div style={{ marginBottom: '30px' }}>
|
|
232
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Secondary Buttons</h3>
|
|
233
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
234
|
+
<Button kind="secondary" size="xs">XS Secondary</Button>
|
|
235
|
+
<Button kind="secondary" size="sm">Small Secondary</Button>
|
|
236
|
+
<Button kind="secondary" size="md">Medium Secondary</Button>
|
|
237
|
+
<Button kind="secondary" size="lg">Large Secondary</Button>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
<div style={{ marginBottom: '30px' }}>
|
|
242
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Tertiary Buttons</h3>
|
|
243
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
244
|
+
<Button kind="tertiary" size="xs">XS Tertiary</Button>
|
|
245
|
+
<Button kind="tertiary" size="sm">Small Tertiary</Button>
|
|
246
|
+
<Button kind="tertiary" size="md">Medium Tertiary</Button>
|
|
247
|
+
<Button kind="tertiary" size="lg">Large Tertiary</Button>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<div style={{ marginBottom: '30px' }}>
|
|
252
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Buttons with Icons</h3>
|
|
253
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
254
|
+
<Button icon={<IconSessionReplay />} iconPosition="left">
|
|
255
|
+
Left Icon
|
|
256
|
+
</Button>
|
|
257
|
+
<Button icon={<IconMetrics />} iconPosition="right">
|
|
258
|
+
Right Icon
|
|
259
|
+
</Button>
|
|
260
|
+
<Button icon={<IconFunnels />} />
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div style={{ marginBottom: '30px' }}>
|
|
265
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Ghost Theme</h3>
|
|
266
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
267
|
+
<Button theme="ghost" icon={<IconSessionReplay />} />
|
|
268
|
+
<Button theme="ghost" icon={<IconMetrics />} />
|
|
269
|
+
<Button theme="ghost" icon={<IconFunnels />} />
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div style={{ marginBottom: '30px' }}>
|
|
274
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Disabled Buttons</h3>
|
|
275
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
276
|
+
<Button disabled>Disabled Primary</Button>
|
|
277
|
+
<Button kind="secondary" disabled>Disabled Secondary</Button>
|
|
278
|
+
<Button kind="tertiary" disabled>Disabled Tertiary</Button>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div style={{ marginBottom: '30px' }}>
|
|
283
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Link Buttons</h3>
|
|
284
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
285
|
+
<Button href="/docs">Documentation</Button>
|
|
286
|
+
<Button href="https://github.com" kind="secondary">GitHub</Button>
|
|
287
|
+
<Button href="/api" kind="tertiary">API</Button>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
),
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// Real-world examples
|
|
295
|
+
export const RealWorldExamples: Story = {
|
|
296
|
+
render: () => (
|
|
297
|
+
<div style={{ padding: '20px', maxWidth: '800px' }}>
|
|
298
|
+
<div style={{ marginBottom: '30px' }}>
|
|
299
|
+
<h2>Documentation Actions</h2>
|
|
300
|
+
<p>Common button patterns used in documentation sites.</p>
|
|
301
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center', marginTop: '16px' }}>
|
|
302
|
+
<Button href="/docs/getting-started" icon={<IconSessionReplay />}>
|
|
303
|
+
Get Started
|
|
304
|
+
</Button>
|
|
305
|
+
<Button href="https://github.com" kind="secondary">
|
|
306
|
+
View on GitHub
|
|
307
|
+
</Button>
|
|
308
|
+
<Button href="/api" kind="tertiary">
|
|
309
|
+
API Reference
|
|
310
|
+
</Button>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div style={{ marginBottom: '30px' }}>
|
|
315
|
+
<h2>Form Actions</h2>
|
|
316
|
+
<p>Buttons commonly used in forms and interactive elements.</p>
|
|
317
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center', marginTop: '16px' }}>
|
|
318
|
+
<Button icon={<IconMetrics />}>
|
|
319
|
+
Save Changes
|
|
320
|
+
</Button>
|
|
321
|
+
<Button kind="secondary">
|
|
322
|
+
Cancel
|
|
323
|
+
</Button>
|
|
324
|
+
<Button kind="tertiary">
|
|
325
|
+
Reset
|
|
326
|
+
</Button>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
|
|
330
|
+
<div style={{ marginBottom: '30px' }}>
|
|
331
|
+
<h2>Navigation Actions</h2>
|
|
332
|
+
<p>Buttons used for navigation and user actions.</p>
|
|
333
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center', marginTop: '16px' }}>
|
|
334
|
+
<Button href="/next-page">
|
|
335
|
+
Continue
|
|
336
|
+
</Button>
|
|
337
|
+
<Button href="/previous-page" kind="secondary">
|
|
338
|
+
Back
|
|
339
|
+
</Button>
|
|
340
|
+
<Button theme="ghost" icon={<IconFunnels />} />
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
<div style={{ marginBottom: '30px' }}>
|
|
345
|
+
<h2>Status Actions</h2>
|
|
346
|
+
<p>Buttons that reflect different states and actions.</p>
|
|
347
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center', marginTop: '16px' }}>
|
|
348
|
+
<Button>
|
|
349
|
+
Active Action
|
|
350
|
+
</Button>
|
|
351
|
+
<Button disabled>
|
|
352
|
+
Disabled Action
|
|
353
|
+
</Button>
|
|
354
|
+
<Button kind="secondary" icon={<IconSessionReplay />}>
|
|
355
|
+
Loading...
|
|
356
|
+
</Button>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
),
|
|
361
|
+
parameters: {
|
|
362
|
+
docs: {
|
|
363
|
+
description: {
|
|
364
|
+
story: 'This example shows how buttons are typically used in real-world applications, demonstrating common patterns and use cases.',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// Size comparison
|
|
371
|
+
export const SizeComparison: Story = {
|
|
372
|
+
render: () => (
|
|
373
|
+
<div style={{ padding: '20px' }}>
|
|
374
|
+
<div style={{ marginBottom: '20px' }}>
|
|
375
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Primary Buttons</h3>
|
|
376
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
377
|
+
<Button size="xs">Extra Small</Button>
|
|
378
|
+
<Button size="sm">Small</Button>
|
|
379
|
+
<Button size="md">Medium</Button>
|
|
380
|
+
<Button size="lg">Large</Button>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div style={{ marginBottom: '20px' }}>
|
|
385
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>With Icons</h3>
|
|
386
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
387
|
+
<Button size="xs" icon={<IconSessionReplay />}>XS</Button>
|
|
388
|
+
<Button size="sm" icon={<IconSessionReplay />}>Small</Button>
|
|
389
|
+
<Button size="md" icon={<IconSessionReplay />}>Medium</Button>
|
|
390
|
+
<Button size="lg" icon={<IconSessionReplay />}>Large</Button>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<div style={{ marginBottom: '20px' }}>
|
|
395
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Icon Only</h3>
|
|
396
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
397
|
+
<Button size="xs" icon={<IconSessionReplay />} />
|
|
398
|
+
<Button size="sm" icon={<IconSessionReplay />} />
|
|
399
|
+
<Button size="md" icon={<IconSessionReplay />} />
|
|
400
|
+
<Button size="lg" icon={<IconSessionReplay />} />
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
),
|
|
405
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Callout,
|
|
6
|
+
} from '@xyd-js/components/writer';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Callout> = {
|
|
9
|
+
title: 'Components/Writer/Callout',
|
|
10
|
+
component: Callout,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'Callout component is used to display important information, notices, or warnings in a visually distinct way.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
children: {
|
|
20
|
+
description: 'The content to display inside the callout',
|
|
21
|
+
control: 'text',
|
|
22
|
+
},
|
|
23
|
+
kind: {
|
|
24
|
+
description: 'The visual style variant of the callout',
|
|
25
|
+
control: { type: 'select' },
|
|
26
|
+
options: ['note', 'tip', 'check', 'warning', 'danger'],
|
|
27
|
+
},
|
|
28
|
+
className: {
|
|
29
|
+
description: 'Additional CSS classes to apply',
|
|
30
|
+
control: 'text',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof Callout>;
|
|
37
|
+
|
|
38
|
+
// Default (info) callout
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
children: 'This is a default callout with informational content. It provides important context or notes to the user.',
|
|
42
|
+
},
|
|
43
|
+
render: (args) => (
|
|
44
|
+
<div style={{width: 700}}>
|
|
45
|
+
<Callout {...args} />
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Note variant
|
|
51
|
+
export const Note: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
children: 'This is a note callout. Use this for general information, context, or helpful details that users should be aware of.',
|
|
54
|
+
kind: 'note',
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<div style={{width: 700}}>
|
|
58
|
+
<Callout {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Tip variant
|
|
64
|
+
export const Tip: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
children: 'This is a tip callout. Use this for helpful suggestions, best practices, or pro tips that can improve the user experience.',
|
|
67
|
+
kind: 'tip',
|
|
68
|
+
},
|
|
69
|
+
render: (args) => (
|
|
70
|
+
<div style={{width: 700}}>
|
|
71
|
+
<Callout {...args} />
|
|
72
|
+
</div>
|
|
73
|
+
),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Check variant
|
|
77
|
+
export const Check: Story = {
|
|
78
|
+
args: {
|
|
79
|
+
children: 'This is a check callout. Use this for confirmation messages, successful actions, or positive feedback.',
|
|
80
|
+
kind: 'check',
|
|
81
|
+
},
|
|
82
|
+
render: (args) => (
|
|
83
|
+
<div style={{width: 700}}>
|
|
84
|
+
<Callout {...args} />
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Warning variant
|
|
90
|
+
export const Warning: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
children: 'This is a warning callout. Use this for important notices, potential issues, or actions that require attention.',
|
|
93
|
+
kind: 'warning',
|
|
94
|
+
},
|
|
95
|
+
render: (args) => (
|
|
96
|
+
<div style={{width: 700}}>
|
|
97
|
+
<Callout {...args} />
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Danger variant
|
|
103
|
+
export const Danger: Story = {
|
|
104
|
+
args: {
|
|
105
|
+
children: 'This is a danger callout. Use this for critical errors, destructive actions, or situations that require immediate attention.',
|
|
106
|
+
kind: 'danger',
|
|
107
|
+
},
|
|
108
|
+
render: (args) => (
|
|
109
|
+
<div style={{width: 700}}>
|
|
110
|
+
<Callout {...args} />
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// All variants showcase
|
|
116
|
+
export const AllVariants: Story = {
|
|
117
|
+
render: () => (
|
|
118
|
+
<div style={{width: 700}}>
|
|
119
|
+
<div style={{ marginBottom: '20px' }}>
|
|
120
|
+
<Callout>
|
|
121
|
+
Default callout with informational content
|
|
122
|
+
</Callout>
|
|
123
|
+
</div>
|
|
124
|
+
<div style={{ marginBottom: '20px' }}>
|
|
125
|
+
<Callout kind="note">
|
|
126
|
+
Note callout for general information and context
|
|
127
|
+
</Callout>
|
|
128
|
+
</div>
|
|
129
|
+
<div style={{ marginBottom: '20px' }}>
|
|
130
|
+
<Callout kind="tip">
|
|
131
|
+
Tip callout for helpful suggestions and best practices
|
|
132
|
+
</Callout>
|
|
133
|
+
</div>
|
|
134
|
+
<div style={{ marginBottom: '20px' }}>
|
|
135
|
+
<Callout kind="check">
|
|
136
|
+
Check callout for confirmation and success messages
|
|
137
|
+
</Callout>
|
|
138
|
+
</div>
|
|
139
|
+
<div style={{ marginBottom: '20px' }}>
|
|
140
|
+
<Callout kind="warning">
|
|
141
|
+
Warning callout for important notices and potential issues
|
|
142
|
+
</Callout>
|
|
143
|
+
</div>
|
|
144
|
+
<div style={{ marginBottom: '20px' }}>
|
|
145
|
+
<Callout kind="danger">
|
|
146
|
+
Danger callout for critical errors and destructive actions
|
|
147
|
+
</Callout>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
),
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// With longer content
|
|
154
|
+
export const WithLongContent: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
children: 'This is a callout with longer content that demonstrates how the component handles multi-line text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
157
|
+
kind: 'note',
|
|
158
|
+
},
|
|
159
|
+
render: (args) => (
|
|
160
|
+
<div style={{width: 700}}>
|
|
161
|
+
<Callout {...args} />
|
|
162
|
+
</div>
|
|
163
|
+
),
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// With HTML content
|
|
167
|
+
export const WithHTMLContent: Story = {
|
|
168
|
+
args: {
|
|
169
|
+
children: (
|
|
170
|
+
<>
|
|
171
|
+
This callout contains <strong>bold text</strong>, <em>italic text</em>, and a <a href="#" style={{ color: 'inherit', textDecoration: 'underline' }}>link</a>.
|
|
172
|
+
<br />
|
|
173
|
+
It also demonstrates how the component handles HTML elements and line breaks.
|
|
174
|
+
</>
|
|
175
|
+
),
|
|
176
|
+
kind: 'tip',
|
|
177
|
+
},
|
|
178
|
+
render: (args) => (
|
|
179
|
+
<div style={{width: 700}}>
|
|
180
|
+
<Callout {...args} />
|
|
181
|
+
</div>
|
|
182
|
+
),
|
|
183
|
+
};
|