@reliability-design/web 1.0.2
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/dist/components/rel-accordion/rel-accordion.stories.ts +313 -0
- package/dist/components/rel-accordion/rel-accordion.ts +114 -0
- package/dist/components/rel-alert/rel-alert.stories.ts +412 -0
- package/dist/components/rel-alert/rel-alert.ts +194 -0
- package/dist/components/rel-avatar/rel-avatar.stories.ts +327 -0
- package/dist/components/rel-avatar/rel-avatar.ts +100 -0
- package/dist/components/rel-badge/rel-badge.stories.ts +350 -0
- package/dist/components/rel-badge/rel-badge.ts +70 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +306 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +97 -0
- package/dist/components/rel-button/rel-button.stories.ts +356 -0
- package/dist/components/rel-button/rel-button.ts +204 -0
- package/dist/components/rel-card/rel-card.stories.ts +299 -0
- package/dist/components/rel-card/rel-card.ts +33 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +368 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +80 -0
- package/dist/components/rel-checkbox/rel-checkbox.stories.ts +414 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +164 -0
- package/dist/components/rel-chip/rel-chip.stories.ts +552 -0
- package/dist/components/rel-chip/rel-chip.ts +261 -0
- package/dist/components/rel-container/rel-container.stories.ts +239 -0
- package/dist/components/rel-container/rel-container.ts +74 -0
- package/dist/components/rel-divider/rel-divider.stories.ts +229 -0
- package/dist/components/rel-divider/rel-divider.ts +44 -0
- package/dist/components/rel-layout/rel-layout.stories.ts +713 -0
- package/dist/components/rel-layout/rel-layout.ts +60 -0
- package/dist/components/rel-menu/rel-menu.stories.ts +910 -0
- package/dist/components/rel-menu/rel-menu.ts +319 -0
- package/dist/components/rel-progress/rel-progress.stories.ts +817 -0
- package/dist/components/rel-progress/rel-progress.ts +182 -0
- package/dist/components/rel-radio/rel-radio.stories.ts +1048 -0
- package/dist/components/rel-radio/rel-radio.ts +187 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +1079 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +150 -0
- package/dist/components/rel-select/rel-select.stories.ts +1201 -0
- package/dist/components/rel-select/rel-select.ts +261 -0
- package/dist/components/rel-slider/rel-slider.stories.ts +730 -0
- package/dist/components/rel-slider/rel-slider.ts +440 -0
- package/dist/components/rel-snackbar/rel-snackbar.stories.ts +808 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +212 -0
- package/dist/components/rel-stepper/rel-stepper.stories.ts +752 -0
- package/dist/components/rel-stepper/rel-stepper.ts +425 -0
- package/dist/components/rel-switch/rel-switch.stories.ts +441 -0
- package/dist/components/rel-switch/rel-switch.ts +161 -0
- package/dist/components/rel-tab/rel-tab.stories.ts +492 -0
- package/dist/components/rel-tab/rel-tab.ts +145 -0
- package/dist/components/rel-textfield/rel-textfield.stories.ts +710 -0
- package/dist/components/rel-textfield/rel-textfield.ts +224 -0
- package/dist/components/rel-toast/rel-toast.stories.ts +394 -0
- package/dist/components/rel-toast/rel-toast.ts +154 -0
- package/dist/components/rel-tooltip/rel-tooltip.stories.ts +364 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +80 -0
- package/dist/index.d.mts +372 -0
- package/dist/index.d.ts +372 -0
- package/dist/index.js +4593 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4544 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/vars.css +184 -0
- package/package.json +32 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import './rel-cardmedia';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The Card Media component combines images with content in an elevated card format.
|
|
7
|
+
* Built with Lit web components for framework-agnostic usage.
|
|
8
|
+
*
|
|
9
|
+
* ## Features
|
|
10
|
+
* - **Image Support**: Display images at the top of the card
|
|
11
|
+
* - **Title & Subtitle**: Built-in typography for headers and descriptions
|
|
12
|
+
* - **Slotted Content**: Add buttons, links, or additional content
|
|
13
|
+
* - **Elevated Shadow**: Drop shadow for depth
|
|
14
|
+
* - **Hover Effect**: Lifts on hover with enhanced shadow
|
|
15
|
+
* - **Rounded Corners**: Smooth border radius
|
|
16
|
+
*/
|
|
17
|
+
const meta: Meta = {
|
|
18
|
+
title: 'Components/CardMedia',
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
component: 'rel-card-media',
|
|
21
|
+
argTypes: {
|
|
22
|
+
imageSrc: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Image source URL',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
imageAlt: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Image alt text for accessibility',
|
|
32
|
+
table: {
|
|
33
|
+
defaultValue: { summary: 'Card image' },
|
|
34
|
+
type: { summary: 'string' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
title: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Card title',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'string' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
subtitle: {
|
|
45
|
+
control: 'text',
|
|
46
|
+
description: 'Card subtitle or description',
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: 'string' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
render: (args) => html`
|
|
53
|
+
<rel-card-media
|
|
54
|
+
imageSrc="${args.imageSrc || 'https://picsum.photos/400/250'}"
|
|
55
|
+
imageAlt="${args.imageAlt || 'Card image'}"
|
|
56
|
+
title="${args.title || 'Card Title'}"
|
|
57
|
+
subtitle="${args.subtitle || 'Card subtitle or description'}"
|
|
58
|
+
>
|
|
59
|
+
${args.content || ''}
|
|
60
|
+
</rel-card-media>
|
|
61
|
+
`,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default meta;
|
|
65
|
+
type Story = StoryObj;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Default card media - basic image card
|
|
69
|
+
*/
|
|
70
|
+
export const Default: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
imageSrc: 'https://picsum.photos/400/250',
|
|
73
|
+
imageAlt: 'Beautiful scenery',
|
|
74
|
+
title: 'Beautiful Landscape',
|
|
75
|
+
subtitle: 'Captured in the perfect moment',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Product card - e-commerce product display
|
|
81
|
+
*/
|
|
82
|
+
export const ProductCard: Story = {
|
|
83
|
+
render: () => html`
|
|
84
|
+
<rel-card-media
|
|
85
|
+
imageSrc="https://picsum.photos/400/400"
|
|
86
|
+
imageAlt="Product"
|
|
87
|
+
title="Premium Wireless Headphones"
|
|
88
|
+
subtitle="High-quality audio with active noise cancellation"
|
|
89
|
+
>
|
|
90
|
+
<div style="margin-top: 12px; display: flex; justify-content: space-between; align-items: center;">
|
|
91
|
+
<span style="font-size: 24px; font-weight: 700; color: #000;">$299</span>
|
|
92
|
+
<button style="background: #00F49C; border: none; color: #000; padding: 8px 16px; border-radius: 1000px; cursor: pointer; font-weight: 600;">
|
|
93
|
+
Add to Cart
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
</rel-card-media>
|
|
97
|
+
`,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Blog post card - article preview
|
|
102
|
+
*/
|
|
103
|
+
export const BlogPostCard: Story = {
|
|
104
|
+
render: () => html`
|
|
105
|
+
<rel-card-media
|
|
106
|
+
imageSrc="https://picsum.photos/500/300"
|
|
107
|
+
imageAlt="Blog post cover"
|
|
108
|
+
title="Getting Started with Web Components"
|
|
109
|
+
subtitle="Learn how to build reusable UI components using modern web standards."
|
|
110
|
+
>
|
|
111
|
+
<div style="margin-top: 12px; display: flex; align-items: center; justify-content: space-between;">
|
|
112
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
113
|
+
<img src="https://i.pravatar.cc/32?img=3" alt="Author" style="width: 32px; height: 32px; border-radius: 50%;" />
|
|
114
|
+
<span style="color: #666; font-size: 14px;">Sarah Wilson</span>
|
|
115
|
+
</div>
|
|
116
|
+
<span style="color: #999; font-size: 12px;">5 min read</span>
|
|
117
|
+
</div>
|
|
118
|
+
</rel-card-media>
|
|
119
|
+
`,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Recipe card - food recipe display
|
|
124
|
+
*/
|
|
125
|
+
export const RecipeCard: Story = {
|
|
126
|
+
render: () => html`
|
|
127
|
+
<rel-card-media
|
|
128
|
+
imageSrc="https://picsum.photos/400/300"
|
|
129
|
+
imageAlt="Delicious food"
|
|
130
|
+
title="Homemade Pizza"
|
|
131
|
+
subtitle="A classic Italian favorite with fresh ingredients"
|
|
132
|
+
>
|
|
133
|
+
<div style="margin-top: 12px;">
|
|
134
|
+
<div style="display: flex; gap: 16px; margin-bottom: 12px;">
|
|
135
|
+
<span style="color: #666; font-size: 12px;">⏱️ 45 min</span>
|
|
136
|
+
<span style="color: #666; font-size: 12px;">👥 4 servings</span>
|
|
137
|
+
<span style="color: #666; font-size: 12px;">🔥 Medium</span>
|
|
138
|
+
</div>
|
|
139
|
+
<button style="width: 100%; background: #00F49C; border: none; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
140
|
+
View Recipe
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
</rel-card-media>
|
|
144
|
+
`,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Property listing - real estate card
|
|
149
|
+
*/
|
|
150
|
+
export const PropertyListing: Story = {
|
|
151
|
+
render: () => html`
|
|
152
|
+
<rel-card-media
|
|
153
|
+
imageSrc="https://picsum.photos/500/350"
|
|
154
|
+
imageAlt="Property"
|
|
155
|
+
title="Modern Downtown Apartment"
|
|
156
|
+
subtitle="2 bed • 2 bath • 1,200 sq ft"
|
|
157
|
+
>
|
|
158
|
+
<div style="margin-top: 12px;">
|
|
159
|
+
<div style="margin-bottom: 12px;">
|
|
160
|
+
<span style="font-size: 28px; font-weight: 700; color: #000;">$450,000</span>
|
|
161
|
+
</div>
|
|
162
|
+
<p style="margin: 0 0 12px 0; color: #666; font-size: 14px;">
|
|
163
|
+
📍 123 Main Street, Downtown District
|
|
164
|
+
</p>
|
|
165
|
+
<div style="display: flex; gap: 8px;">
|
|
166
|
+
<button style="flex: 1; background: #00F49C; border: none; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
167
|
+
Schedule Tour
|
|
168
|
+
</button>
|
|
169
|
+
<button style="flex: 1; background: #fff; border: 1px solid #ddd; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
170
|
+
Save
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</rel-card-media>
|
|
175
|
+
`,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Event card - upcoming event display
|
|
180
|
+
*/
|
|
181
|
+
export const EventCard: Story = {
|
|
182
|
+
render: () => html`
|
|
183
|
+
<rel-card-media
|
|
184
|
+
imageSrc="https://picsum.photos/450/280"
|
|
185
|
+
imageAlt="Event"
|
|
186
|
+
title="Tech Conference 2024"
|
|
187
|
+
subtitle="Join industry leaders for 3 days of innovation and networking"
|
|
188
|
+
>
|
|
189
|
+
<div style="margin-top: 12px;">
|
|
190
|
+
<div style="background: #E1F2FF; padding: 12px; border-radius: 8px; margin-bottom: 12px;">
|
|
191
|
+
<p style="margin: 0 0 4px 0; color: #0091EA; font-size: 14px; font-weight: 600;">📅 March 15-17, 2024</p>
|
|
192
|
+
<p style="margin: 0; color: #0091EA; font-size: 14px;">📍 San Francisco Convention Center</p>
|
|
193
|
+
</div>
|
|
194
|
+
<button style="width: 100%; background: #00F49C; border: none; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
195
|
+
Register Now
|
|
196
|
+
</button>
|
|
197
|
+
</div>
|
|
198
|
+
</rel-card-media>
|
|
199
|
+
`,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Course card - online course preview
|
|
204
|
+
*/
|
|
205
|
+
export const CourseCard: Story = {
|
|
206
|
+
render: () => html`
|
|
207
|
+
<rel-card-media
|
|
208
|
+
imageSrc="https://picsum.photos/420/260"
|
|
209
|
+
imageAlt="Course"
|
|
210
|
+
title="Complete Web Development Bootcamp"
|
|
211
|
+
subtitle="Learn HTML, CSS, JavaScript, and modern frameworks from scratch"
|
|
212
|
+
>
|
|
213
|
+
<div style="margin-top: 12px;">
|
|
214
|
+
<div style="display: flex; gap: 8px; margin-bottom: 12px;">
|
|
215
|
+
<span style="padding: 4px 8px; background: #FFE9D9; color: #FF6D00; border-radius: 4px; font-size: 12px; font-weight: 600;">Beginner</span>
|
|
216
|
+
<span style="padding: 4px 8px; background: #E1F2FF; color: #0091EA; border-radius: 4px; font-size: 12px; font-weight: 600;">40 hours</span>
|
|
217
|
+
</div>
|
|
218
|
+
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;">
|
|
219
|
+
<div style="display: flex; align-items: center; gap: 4px;">
|
|
220
|
+
<span style="color: #FFD700;">★★★★★</span>
|
|
221
|
+
<span style="color: #666; font-size: 12px;">(2,543 reviews)</span>
|
|
222
|
+
</div>
|
|
223
|
+
<span style="font-size: 20px; font-weight: 700; color: #000;">$89</span>
|
|
224
|
+
</div>
|
|
225
|
+
<button style="width: 100%; background: #00F49C; border: none; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
226
|
+
Enroll Now
|
|
227
|
+
</button>
|
|
228
|
+
</div>
|
|
229
|
+
</rel-card-media>
|
|
230
|
+
`,
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Team member card - employee profile
|
|
235
|
+
*/
|
|
236
|
+
export const TeamMemberCard: Story = {
|
|
237
|
+
render: () => html`
|
|
238
|
+
<rel-card-media
|
|
239
|
+
imageSrc="https://i.pravatar.cc/400?img=5"
|
|
240
|
+
imageAlt="Team member"
|
|
241
|
+
title="Alex Johnson"
|
|
242
|
+
subtitle="Senior Product Designer"
|
|
243
|
+
>
|
|
244
|
+
<div style="margin-top: 12px;">
|
|
245
|
+
<p style="margin: 0 0 12px 0; color: #666; font-size: 14px; line-height: 1.6;">
|
|
246
|
+
Passionate about creating intuitive user experiences and building design systems that scale.
|
|
247
|
+
</p>
|
|
248
|
+
<div style="display: flex; gap: 8px;">
|
|
249
|
+
<button style="flex: 1; background: #00F49C; border: none; color: #000; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
250
|
+
View Profile
|
|
251
|
+
</button>
|
|
252
|
+
<button style="background: #fff; border: 1px solid #ddd; color: #000; padding: 8px 12px; border-radius: 8px; cursor: pointer;">
|
|
253
|
+
💬
|
|
254
|
+
</button>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</rel-card-media>
|
|
258
|
+
`,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Travel destination card
|
|
263
|
+
*/
|
|
264
|
+
export const TravelCard: Story = {
|
|
265
|
+
render: () => html`
|
|
266
|
+
<rel-card-media
|
|
267
|
+
imageSrc="https://picsum.photos/480/320"
|
|
268
|
+
imageAlt="Travel destination"
|
|
269
|
+
title="Santorini, Greece"
|
|
270
|
+
subtitle="Experience the beauty of the Greek islands"
|
|
271
|
+
>
|
|
272
|
+
<div style="margin-top: 12px;">
|
|
273
|
+
<div style="margin-bottom: 12px;">
|
|
274
|
+
<span style="color: #FFD700; font-size: 16px;">★★★★★</span>
|
|
275
|
+
<span style="color: #666; font-size: 14px; margin-left: 4px;">4.9 (1,234 reviews)</span>
|
|
276
|
+
</div>
|
|
277
|
+
<p style="margin: 0 0 12px 0; color: #666; font-size: 14px;">
|
|
278
|
+
7 days • All inclusive • Flights & hotel
|
|
279
|
+
</p>
|
|
280
|
+
<div style="display: flex; align-items: center; justify-content: space-between;">
|
|
281
|
+
<div>
|
|
282
|
+
<span style="color: #999; font-size: 12px; text-decoration: line-through;">$1,999</span>
|
|
283
|
+
<span style="font-size: 24px; font-weight: 700; color: #000; margin-left: 8px;">$1,499</span>
|
|
284
|
+
</div>
|
|
285
|
+
<button style="background: #00F49C; border: none; color: #000; padding: 8px 16px; border-radius: 1000px; cursor: pointer; font-weight: 600;">
|
|
286
|
+
Book Now
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
</rel-card-media>
|
|
291
|
+
`,
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* News article card
|
|
296
|
+
*/
|
|
297
|
+
export const NewsCard: Story = {
|
|
298
|
+
render: () => html`
|
|
299
|
+
<rel-card-media
|
|
300
|
+
imageSrc="https://picsum.photos/460/290"
|
|
301
|
+
imageAlt="News"
|
|
302
|
+
title="Major Tech Breakthrough Announced"
|
|
303
|
+
subtitle="Scientists discover revolutionary new material"
|
|
304
|
+
>
|
|
305
|
+
<div style="margin-top: 12px;">
|
|
306
|
+
<div style="display: flex; gap: 8px; margin-bottom: 12px;">
|
|
307
|
+
<span style="padding: 4px 8px; background: #FFE8EB; color: #CC0000; border-radius: 4px; font-size: 12px; font-weight: 600;">Breaking</span>
|
|
308
|
+
<span style="padding: 4px 8px; background: #E1F2FF; color: #0091EA; border-radius: 4px; font-size: 12px; font-weight: 600;">Science</span>
|
|
309
|
+
</div>
|
|
310
|
+
<p style="margin: 0 0 12px 0; color: #999; font-size: 12px;">
|
|
311
|
+
Published 2 hours ago by Tech News Daily
|
|
312
|
+
</p>
|
|
313
|
+
<button style="width: 100%; background: #fff; border: 1px solid #ddd; color: #000; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;">
|
|
314
|
+
Read Full Article
|
|
315
|
+
</button>
|
|
316
|
+
</div>
|
|
317
|
+
</rel-card-media>
|
|
318
|
+
`,
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Card grid - multiple media cards
|
|
323
|
+
*/
|
|
324
|
+
export const CardGrid: Story = {
|
|
325
|
+
render: () => html`
|
|
326
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; padding: 24px; background: #f5f5f5;">
|
|
327
|
+
<rel-card-media
|
|
328
|
+
imageSrc="https://picsum.photos/400/250?random=1"
|
|
329
|
+
title="Mountain Adventure"
|
|
330
|
+
subtitle="Explore breathtaking peaks"
|
|
331
|
+
></rel-card-media>
|
|
332
|
+
|
|
333
|
+
<rel-card-media
|
|
334
|
+
imageSrc="https://picsum.photos/400/250?random=2"
|
|
335
|
+
title="Ocean Paradise"
|
|
336
|
+
subtitle="Discover tropical beaches"
|
|
337
|
+
></rel-card-media>
|
|
338
|
+
|
|
339
|
+
<rel-card-media
|
|
340
|
+
imageSrc="https://picsum.photos/400/250?random=3"
|
|
341
|
+
title="City Lights"
|
|
342
|
+
subtitle="Experience urban energy"
|
|
343
|
+
></rel-card-media>
|
|
344
|
+
|
|
345
|
+
<rel-card-media
|
|
346
|
+
imageSrc="https://picsum.photos/400/250?random=4"
|
|
347
|
+
title="Forest Escape"
|
|
348
|
+
subtitle="Connect with nature"
|
|
349
|
+
></rel-card-media>
|
|
350
|
+
</div>
|
|
351
|
+
`,
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Without image - card with only content
|
|
356
|
+
*/
|
|
357
|
+
export const WithoutImage: Story = {
|
|
358
|
+
render: () => html`
|
|
359
|
+
<rel-card-media
|
|
360
|
+
title="Text-Only Card"
|
|
361
|
+
subtitle="This card has no image, only content"
|
|
362
|
+
>
|
|
363
|
+
<p style="margin-top: 12px; color: #666; font-size: 14px; line-height: 1.6;">
|
|
364
|
+
Cards don't always need images. This example shows how the card looks with just text content.
|
|
365
|
+
</p>
|
|
366
|
+
</rel-card-media>
|
|
367
|
+
`,
|
|
368
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-card-media")
|
|
5
|
+
export class RelCardMedia extends LitElement {
|
|
6
|
+
@property({ type: String }) imageSrc = "";
|
|
7
|
+
@property({ type: String }) imageAlt = "Card image";
|
|
8
|
+
@property({ type: String }) title = "";
|
|
9
|
+
@property({ type: String }) subtitle = "";
|
|
10
|
+
|
|
11
|
+
static styles = css`
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.card-media {
|
|
18
|
+
background-color: var(--rel-colors-white, #ffffff);
|
|
19
|
+
border-radius: var(--rel-borderRadius-lg, 12px);
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
|
|
22
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),
|
|
23
|
+
0px 8px 12px 6px rgba(0, 0, 0, 0.15);
|
|
24
|
+
|
|
25
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.card-media:hover {
|
|
29
|
+
transform: translateY(-4px);
|
|
30
|
+
box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.35),
|
|
31
|
+
0px 10px 16px 6px rgba(0, 0, 0, 0.2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.card-image img {
|
|
35
|
+
display: block;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: auto;
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card-content {
|
|
42
|
+
padding: var(--rel-spacing-space-md, 16px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.card-content h3 {
|
|
46
|
+
margin: 0 0 4px 0;
|
|
47
|
+
font-size: var(--rel-fontSizes-md, 16px);
|
|
48
|
+
font-weight: var(--rel-fontWeights-semibold, 600);
|
|
49
|
+
color: var(--rel-colors-gray-heading, #2b2b2b);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.card-content p {
|
|
53
|
+
margin: 0 0 8px 0;
|
|
54
|
+
font-size: var(--rel-fontSizes-sm, 14px);
|
|
55
|
+
color: var(--rel-colors-gray-text, #555);
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
render() {
|
|
60
|
+
return html`
|
|
61
|
+
<div class="card-media">
|
|
62
|
+
${this.imageSrc
|
|
63
|
+
? html`
|
|
64
|
+
<div class="card-image">
|
|
65
|
+
<img src="${this.imageSrc}" alt="${this.imageAlt}" />
|
|
66
|
+
</div>
|
|
67
|
+
`
|
|
68
|
+
: null}
|
|
69
|
+
|
|
70
|
+
<div class="card-content">
|
|
71
|
+
${this.title ? html`<h3>${this.title}</h3>` : null}
|
|
72
|
+
${this.subtitle ? html`<p>${this.subtitle}</p>` : null}
|
|
73
|
+
|
|
74
|
+
<!-- Slot for extra content such as buttons, descriptions, etc -->
|
|
75
|
+
<slot></slot>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
}
|