@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,457 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Card } from '@xyd-js/components/writer';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Card> = {
|
|
7
|
+
title: 'Components/Writer/Card',
|
|
8
|
+
component: Card,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'Card component displays content in a structured layout with optional image, title, description, and link functionality. Used for displaying articles, products, or any structured content.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
title: {
|
|
18
|
+
description: 'The main title of the card',
|
|
19
|
+
control: 'text',
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
description: 'Optional description text below the title',
|
|
23
|
+
control: 'text',
|
|
24
|
+
},
|
|
25
|
+
href: {
|
|
26
|
+
description: 'URL to navigate to when the title is clicked',
|
|
27
|
+
control: 'text',
|
|
28
|
+
},
|
|
29
|
+
link: {
|
|
30
|
+
description: 'Custom link component to use instead of default anchor',
|
|
31
|
+
control: false,
|
|
32
|
+
},
|
|
33
|
+
imgSrc: {
|
|
34
|
+
description: 'URL of the image to display at the top of the card',
|
|
35
|
+
control: 'text',
|
|
36
|
+
},
|
|
37
|
+
imgAlt: {
|
|
38
|
+
description: 'Alt text for the image',
|
|
39
|
+
control: 'text',
|
|
40
|
+
},
|
|
41
|
+
shadow: {
|
|
42
|
+
description: 'Shadow variant for the card',
|
|
43
|
+
control: { type: 'select' },
|
|
44
|
+
options: ['md'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default meta;
|
|
50
|
+
type Story = StoryObj<typeof Card>;
|
|
51
|
+
|
|
52
|
+
// Basic usage
|
|
53
|
+
export const Default: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
title: 'Getting Started with Documentation',
|
|
56
|
+
description: 'Learn how to create and organize your documentation effectively.',
|
|
57
|
+
},
|
|
58
|
+
render: (args) => (
|
|
59
|
+
<div style={{ padding: '20px' }}>
|
|
60
|
+
<Card {...args} />
|
|
61
|
+
</div>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// With image
|
|
66
|
+
export const WithImage: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
title: 'API Reference Guide',
|
|
69
|
+
description: 'Complete reference for all available API endpoints and parameters.',
|
|
70
|
+
imgSrc: 'https://images.unsplash.com/photo-1518709268805-4e9042af2176?w=400&h=200&fit=crop',
|
|
71
|
+
imgAlt: 'API documentation screenshot',
|
|
72
|
+
},
|
|
73
|
+
render: (args) => (
|
|
74
|
+
<div style={{ padding: '20px' }}>
|
|
75
|
+
<Card {...args} />
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// With link
|
|
81
|
+
export const WithLink: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
title: 'User Authentication',
|
|
84
|
+
description: 'Implement secure user authentication in your application.',
|
|
85
|
+
href: '/docs/authentication',
|
|
86
|
+
imgSrc: 'https://images.unsplash.com/photo-1555949963-ff9fe0c870eb?w=400&h=200&fit=crop',
|
|
87
|
+
imgAlt: 'Authentication flow diagram',
|
|
88
|
+
},
|
|
89
|
+
render: (args) => (
|
|
90
|
+
<div style={{ padding: '20px' }}>
|
|
91
|
+
<Card {...args} />
|
|
92
|
+
</div>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// With shadow
|
|
97
|
+
export const WithShadow: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
title: 'Advanced Configuration',
|
|
100
|
+
description: 'Configure advanced settings and customizations for your project.',
|
|
101
|
+
shadow: 'md',
|
|
102
|
+
imgSrc: 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=400&h=200&fit=crop',
|
|
103
|
+
imgAlt: 'Configuration panel',
|
|
104
|
+
},
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<div style={{ padding: '20px' }}>
|
|
107
|
+
<Card {...args} />
|
|
108
|
+
</div>
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Without image
|
|
113
|
+
export const WithoutImage: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
title: 'Quick Start Guide',
|
|
116
|
+
description: 'Get up and running with our platform in just a few minutes.',
|
|
117
|
+
href: '/docs/quickstart',
|
|
118
|
+
},
|
|
119
|
+
render: (args) => (
|
|
120
|
+
<div style={{ padding: '20px' }}>
|
|
121
|
+
<Card {...args} />
|
|
122
|
+
</div>
|
|
123
|
+
),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Long content
|
|
127
|
+
export const LongContent: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
title: 'Comprehensive Guide to Building Scalable Applications',
|
|
130
|
+
description: 'This extensive guide covers everything you need to know about building applications that can handle millions of users, including architecture patterns, database design, caching strategies, and deployment best practices.',
|
|
131
|
+
imgSrc: 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=400&h=200&fit=crop',
|
|
132
|
+
imgAlt: 'Scalable architecture diagram',
|
|
133
|
+
href: '/docs/scalability',
|
|
134
|
+
},
|
|
135
|
+
render: (args) => (
|
|
136
|
+
<div style={{ padding: '20px' }}>
|
|
137
|
+
<Card {...args} />
|
|
138
|
+
</div>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Short content
|
|
143
|
+
export const ShortContent: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
title: 'FAQ',
|
|
146
|
+
description: 'Frequently asked questions.',
|
|
147
|
+
href: '/faq',
|
|
148
|
+
},
|
|
149
|
+
render: (args) => (
|
|
150
|
+
<div style={{ padding: '20px' }}>
|
|
151
|
+
<Card {...args} />
|
|
152
|
+
</div>
|
|
153
|
+
),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Multiple cards
|
|
157
|
+
export const MultipleCards: Story = {
|
|
158
|
+
render: () => (
|
|
159
|
+
<div style={{ padding: '20px' }}>
|
|
160
|
+
<div style={{
|
|
161
|
+
display: 'grid',
|
|
162
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
163
|
+
gap: '20px',
|
|
164
|
+
maxWidth: '1200px'
|
|
165
|
+
}}>
|
|
166
|
+
<Card
|
|
167
|
+
title="Getting Started"
|
|
168
|
+
description="Learn the basics and set up your first project."
|
|
169
|
+
href="/docs/getting-started"
|
|
170
|
+
imgSrc="https://images.unsplash.com/photo-1516321318423-f06f85e504b3?w=400&h=200&fit=crop"
|
|
171
|
+
imgAlt="Getting started tutorial"
|
|
172
|
+
/>
|
|
173
|
+
|
|
174
|
+
<Card
|
|
175
|
+
title="API Reference"
|
|
176
|
+
description="Complete API documentation with examples."
|
|
177
|
+
href="/docs/api"
|
|
178
|
+
imgSrc="https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=400&h=200&fit=crop"
|
|
179
|
+
imgAlt="API documentation"
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
<Card
|
|
183
|
+
title="Tutorials"
|
|
184
|
+
description="Step-by-step tutorials for common use cases."
|
|
185
|
+
href="/docs/tutorials"
|
|
186
|
+
imgSrc="https://images.unsplash.com/photo-1461749280684-dccba630e2f6?w=400&h=200&fit=crop"
|
|
187
|
+
imgAlt="Tutorial examples"
|
|
188
|
+
/>
|
|
189
|
+
|
|
190
|
+
<Card
|
|
191
|
+
title="Examples"
|
|
192
|
+
description="Real-world examples and code samples."
|
|
193
|
+
href="/docs/examples"
|
|
194
|
+
imgSrc="https://images.unsplash.com/photo-1555066931-4365d14bab8c?w=400&h=200&fit=crop"
|
|
195
|
+
imgAlt="Code examples"
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// Different image types
|
|
203
|
+
export const DifferentImageTypes: Story = {
|
|
204
|
+
render: () => (
|
|
205
|
+
<div style={{ padding: '20px' }}>
|
|
206
|
+
<div style={{
|
|
207
|
+
display: 'grid',
|
|
208
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
209
|
+
gap: '20px',
|
|
210
|
+
maxWidth: '1200px'
|
|
211
|
+
}}>
|
|
212
|
+
<Card
|
|
213
|
+
title="Landscape Image"
|
|
214
|
+
description="Card with a wide landscape image."
|
|
215
|
+
imgSrc="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop"
|
|
216
|
+
imgAlt="Mountain landscape"
|
|
217
|
+
/>
|
|
218
|
+
|
|
219
|
+
<Card
|
|
220
|
+
title="Portrait Image"
|
|
221
|
+
description="Card with a tall portrait image."
|
|
222
|
+
imgSrc="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400&h=200&fit=crop"
|
|
223
|
+
imgAlt="Portrait photo"
|
|
224
|
+
/>
|
|
225
|
+
|
|
226
|
+
<Card
|
|
227
|
+
title="Abstract Image"
|
|
228
|
+
description="Card with an abstract or pattern image."
|
|
229
|
+
imgSrc="https://images.unsplash.com/photo-1557683316-973673baf926?w=400&h=200&fit=crop"
|
|
230
|
+
imgAlt="Abstract pattern"
|
|
231
|
+
/>
|
|
232
|
+
|
|
233
|
+
<Card
|
|
234
|
+
title="No Image"
|
|
235
|
+
description="Card without any image, relying on text content only."
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
),
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// Shadow variations
|
|
243
|
+
export const ShadowVariations: Story = {
|
|
244
|
+
render: () => (
|
|
245
|
+
<div style={{ padding: '20px' }}>
|
|
246
|
+
<div style={{
|
|
247
|
+
display: 'grid',
|
|
248
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
249
|
+
gap: '20px',
|
|
250
|
+
maxWidth: '1200px'
|
|
251
|
+
}}>
|
|
252
|
+
<Card
|
|
253
|
+
title="Default Shadow"
|
|
254
|
+
description="Card with default shadow styling."
|
|
255
|
+
imgSrc="https://images.unsplash.com/photo-1518709268805-4e9042af2176?w=400&h=200&fit=crop"
|
|
256
|
+
imgAlt="Default shadow example"
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
<Card
|
|
260
|
+
title="Medium Shadow"
|
|
261
|
+
description="Card with medium shadow for enhanced depth."
|
|
262
|
+
shadow="md"
|
|
263
|
+
imgSrc="https://images.unsplash.com/photo-1555949963-ff9fe0c870eb?w=400&h=200&fit=crop"
|
|
264
|
+
imgAlt="Medium shadow example"
|
|
265
|
+
/>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
),
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// Real-world examples
|
|
272
|
+
export const RealWorldExamples: Story = {
|
|
273
|
+
render: () => (
|
|
274
|
+
<div style={{ padding: '20px', maxWidth: '1200px' }}>
|
|
275
|
+
<div style={{ marginBottom: '40px' }}>
|
|
276
|
+
<h2>Documentation Sections</h2>
|
|
277
|
+
<p>Cards are commonly used to organize documentation into clear sections.</p>
|
|
278
|
+
<div style={{
|
|
279
|
+
display: 'grid',
|
|
280
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
281
|
+
gap: '20px',
|
|
282
|
+
marginTop: '20px'
|
|
283
|
+
}}>
|
|
284
|
+
<Card
|
|
285
|
+
title="Installation"
|
|
286
|
+
description="Get started by installing the necessary dependencies and setting up your environment."
|
|
287
|
+
href="/docs/installation"
|
|
288
|
+
imgSrc="https://images.unsplash.com/photo-1518709268805-4e9042af2176?w=400&h=200&fit=crop"
|
|
289
|
+
imgAlt="Installation guide"
|
|
290
|
+
/>
|
|
291
|
+
|
|
292
|
+
<Card
|
|
293
|
+
title="Configuration"
|
|
294
|
+
description="Learn how to configure your project settings and customize behavior."
|
|
295
|
+
href="/docs/configuration"
|
|
296
|
+
imgSrc="https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=400&h=200&fit=crop"
|
|
297
|
+
imgAlt="Configuration panel"
|
|
298
|
+
/>
|
|
299
|
+
|
|
300
|
+
<Card
|
|
301
|
+
title="Deployment"
|
|
302
|
+
description="Deploy your application to production with our step-by-step guide."
|
|
303
|
+
href="/docs/deployment"
|
|
304
|
+
imgSrc="https://images.unsplash.com/photo-1555949963-ff9fe0c870eb?w=400&h=200&fit=crop"
|
|
305
|
+
imgAlt="Deployment process"
|
|
306
|
+
/>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div style={{ marginBottom: '40px' }}>
|
|
311
|
+
<h2>Feature Showcase</h2>
|
|
312
|
+
<p>Cards can highlight different features and capabilities of your product.</p>
|
|
313
|
+
<div style={{
|
|
314
|
+
display: 'grid',
|
|
315
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
316
|
+
gap: '20px',
|
|
317
|
+
marginTop: '20px'
|
|
318
|
+
}}>
|
|
319
|
+
<Card
|
|
320
|
+
title="Real-time Analytics"
|
|
321
|
+
description="Monitor your application performance with real-time metrics and insights."
|
|
322
|
+
href="/features/analytics"
|
|
323
|
+
imgSrc="https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=400&h=200&fit=crop"
|
|
324
|
+
imgAlt="Analytics dashboard"
|
|
325
|
+
shadow="md"
|
|
326
|
+
/>
|
|
327
|
+
|
|
328
|
+
<Card
|
|
329
|
+
title="API Integration"
|
|
330
|
+
description="Connect with third-party services through our comprehensive API."
|
|
331
|
+
href="/features/api"
|
|
332
|
+
imgSrc="https://images.unsplash.com/photo-1555066931-4365d14bab8c?w=400&h=200&fit=crop"
|
|
333
|
+
imgAlt="API integration"
|
|
334
|
+
/>
|
|
335
|
+
|
|
336
|
+
<Card
|
|
337
|
+
title="Security Features"
|
|
338
|
+
description="Enterprise-grade security with authentication, authorization, and encryption."
|
|
339
|
+
href="/features/security"
|
|
340
|
+
imgSrc="https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=400&h=200&fit=crop"
|
|
341
|
+
imgAlt="Security features"
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<div style={{ marginBottom: '40px' }}>
|
|
347
|
+
<h2>Resource Library</h2>
|
|
348
|
+
<p>Organize resources and learning materials with cards.</p>
|
|
349
|
+
<div style={{
|
|
350
|
+
display: 'grid',
|
|
351
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
352
|
+
gap: '20px',
|
|
353
|
+
marginTop: '20px'
|
|
354
|
+
}}>
|
|
355
|
+
<Card
|
|
356
|
+
title="Video Tutorials"
|
|
357
|
+
description="Watch step-by-step video guides for common tasks and workflows."
|
|
358
|
+
href="/resources/videos"
|
|
359
|
+
imgSrc="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop"
|
|
360
|
+
imgAlt="Video tutorials"
|
|
361
|
+
/>
|
|
362
|
+
|
|
363
|
+
<Card
|
|
364
|
+
title="Code Examples"
|
|
365
|
+
description="Browse through practical code examples and implementation patterns."
|
|
366
|
+
href="/resources/examples"
|
|
367
|
+
imgSrc="https://images.unsplash.com/photo-1461749280684-dccba630e2f6?w=400&h=200&fit=crop"
|
|
368
|
+
imgAlt="Code examples"
|
|
369
|
+
/>
|
|
370
|
+
|
|
371
|
+
<Card
|
|
372
|
+
title="Community Forum"
|
|
373
|
+
description="Connect with other developers and get help from the community."
|
|
374
|
+
href="/community"
|
|
375
|
+
imgSrc="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400&h=200&fit=crop"
|
|
376
|
+
imgAlt="Community forum"
|
|
377
|
+
/>
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
),
|
|
382
|
+
parameters: {
|
|
383
|
+
docs: {
|
|
384
|
+
description: {
|
|
385
|
+
story: 'This example shows how cards are typically used in real applications, demonstrating common patterns for documentation, feature showcases, and resource organization.',
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// Interactive example
|
|
392
|
+
export const Interactive: Story = {
|
|
393
|
+
args: {
|
|
394
|
+
title: 'Interactive Card Example',
|
|
395
|
+
description: 'This card demonstrates the interactive behavior. Try clicking the title to see the link functionality.',
|
|
396
|
+
href: '#',
|
|
397
|
+
imgSrc: 'https://images.unsplash.com/photo-1557683316-973673baf926?w=400&h=200&fit=crop',
|
|
398
|
+
imgAlt: 'Interactive example',
|
|
399
|
+
shadow: 'md',
|
|
400
|
+
},
|
|
401
|
+
render: (args) => (
|
|
402
|
+
<div style={{ padding: '20px' }}>
|
|
403
|
+
<Card {...args} />
|
|
404
|
+
<p style={{ marginTop: '10px', fontSize: '14px', color: '#666' }}>
|
|
405
|
+
The card component provides a structured layout for displaying content with optional images, links, and styling variations.
|
|
406
|
+
</p>
|
|
407
|
+
</div>
|
|
408
|
+
),
|
|
409
|
+
parameters: {
|
|
410
|
+
docs: {
|
|
411
|
+
description: {
|
|
412
|
+
story: 'This card demonstrates the interactive behavior including link functionality and hover effects.',
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// Custom link component example
|
|
419
|
+
export const CustomLink: Story = {
|
|
420
|
+
args: {
|
|
421
|
+
title: 'Custom Link Component',
|
|
422
|
+
description: 'This card uses a custom link component instead of the default anchor tag.',
|
|
423
|
+
imgSrc: 'https://images.unsplash.com/photo-1518709268805-4e9042af2176?w=400&h=200&fit=crop',
|
|
424
|
+
imgAlt: 'Custom link example',
|
|
425
|
+
},
|
|
426
|
+
render: (args) => {
|
|
427
|
+
// Custom link component
|
|
428
|
+
const CustomLinkComponent = ({ href, children }: { href: string; children: React.ReactNode }) => (
|
|
429
|
+
<a
|
|
430
|
+
href={href}
|
|
431
|
+
onClick={(e) => {
|
|
432
|
+
e.preventDefault();
|
|
433
|
+
alert(`Custom link clicked: ${href}`);
|
|
434
|
+
}}
|
|
435
|
+
style={{ textDecoration: 'none', color: 'inherit' }}
|
|
436
|
+
>
|
|
437
|
+
{children}
|
|
438
|
+
</a>
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<div style={{ padding: '20px' }}>
|
|
443
|
+
<Card {...args} href="/custom-link" link={CustomLinkComponent} />
|
|
444
|
+
<p style={{ marginTop: '10px', fontSize: '14px', color: '#666' }}>
|
|
445
|
+
This example shows how to use a custom link component with the card.
|
|
446
|
+
</p>
|
|
447
|
+
</div>
|
|
448
|
+
);
|
|
449
|
+
},
|
|
450
|
+
parameters: {
|
|
451
|
+
docs: {
|
|
452
|
+
description: {
|
|
453
|
+
story: 'This example demonstrates how to use a custom link component instead of the default anchor tag.',
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
};
|