@codeforamerica/marcomms-design-system 1.15.2 → 1.17.0
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/index.js +484 -160
- package/package.json +1 -1
- package/src/components/card.js +127 -95
- package/src/components/card.stories.js +13 -61
- package/src/shared/typography.js +349 -41
package/package.json
CHANGED
package/src/components/card.js
CHANGED
|
@@ -184,99 +184,6 @@ class Card extends LitElement {
|
|
|
184
184
|
.logo img {
|
|
185
185
|
object-fit: contain;
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
/* --- */
|
|
189
|
-
|
|
190
|
-
/* Theme: Compact Card */
|
|
191
|
-
|
|
192
|
-
.card--compact {
|
|
193
|
-
--padding: var(--spacing-component-3);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.card--compact .title {
|
|
197
|
-
font-size: var(--font-size-h4);
|
|
198
|
-
line-height: var(--line-height-h4);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.card--compact .action-label {
|
|
202
|
-
padding-block-start: 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/* --- */
|
|
206
|
-
|
|
207
|
-
/* Theme: Horizontal Card */
|
|
208
|
-
|
|
209
|
-
@media (min-width: 768px) {
|
|
210
|
-
.card--horizontal,
|
|
211
|
-
a.card--horizontal {
|
|
212
|
-
align-items: stretch;
|
|
213
|
-
flex-direction: row;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.card--horizontal .visual {
|
|
217
|
-
aspect-ratio: initial;
|
|
218
|
-
height: auto;
|
|
219
|
-
flex: 0 0 50%;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.card--horizontal .logo {
|
|
223
|
-
border-block-end: 0;
|
|
224
|
-
border-inline-end: 1px solid var(--gray-20);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/* --- */
|
|
229
|
-
|
|
230
|
-
/* Theme: Horizontal Compact Card */
|
|
231
|
-
|
|
232
|
-
@media (min-width: 768px) {
|
|
233
|
-
.card--horizontal-compact,
|
|
234
|
-
a.card--horizontal-compact {
|
|
235
|
-
align-items: stretch;
|
|
236
|
-
flex-direction: row;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.card--horizontal-compact .visual {
|
|
240
|
-
aspect-ratio: initial;
|
|
241
|
-
flex: 0 0 34%;
|
|
242
|
-
height: auto;
|
|
243
|
-
position: relative;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.card--horizontal-compact .image picture {
|
|
247
|
-
position: absolute;
|
|
248
|
-
height: 100%;
|
|
249
|
-
width: 100%;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.card--horizontal-compact .logo {
|
|
253
|
-
border-block-end: 0;
|
|
254
|
-
border-right: 1px solid var(--gray-20);
|
|
255
|
-
padding: var(--spacing-component-4);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.card--horizontal-compact,
|
|
260
|
-
a.card--horizontal-compact {
|
|
261
|
-
--padding: var(--spacing-component-3);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.card--horizontal-compact .body {
|
|
265
|
-
gap: var(--spacing-component-2);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.card--horizontal-compact .header {
|
|
269
|
-
margin-block-end: var(--spacing-component-2);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.card--horizontal-compact .title {
|
|
273
|
-
font-size: var(--font-size-h4);
|
|
274
|
-
line-height: var(--line-height-h4);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.card--horizontal-compact .action-label {
|
|
278
|
-
padding-block-start: var(--spacing-component-2);
|
|
279
|
-
}
|
|
280
187
|
`,
|
|
281
188
|
];
|
|
282
189
|
visualTemplate() {
|
|
@@ -362,13 +269,13 @@ class Card extends LitElement {
|
|
|
362
269
|
</div>
|
|
363
270
|
<div class="body">
|
|
364
271
|
${this.text
|
|
365
|
-
? html` <div class="small" .innerHTML
|
|
272
|
+
? html` <div class="small" .innerHTML=${this.text}></div> `
|
|
366
273
|
: nothing}
|
|
367
274
|
${this.metaText
|
|
368
275
|
? html`
|
|
369
276
|
<div
|
|
370
277
|
class="meta-text small"
|
|
371
|
-
.innerHTML
|
|
278
|
+
.innerHTML=${this.metaText}
|
|
372
279
|
></div>
|
|
373
280
|
`
|
|
374
281
|
: nothing}
|
|
@@ -401,6 +308,131 @@ class Card extends LitElement {
|
|
|
401
308
|
}
|
|
402
309
|
}
|
|
403
310
|
|
|
311
|
+
class CardSkeleton extends LitElement {
|
|
312
|
+
static styles = [
|
|
313
|
+
commonStyles,
|
|
314
|
+
typographyStyles,
|
|
315
|
+
css`
|
|
316
|
+
:host {
|
|
317
|
+
display: flex;
|
|
318
|
+
flex-direction: column;
|
|
319
|
+
margin-inline: auto;
|
|
320
|
+
max-width: 100%;
|
|
321
|
+
width: 100%;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.card-skeleton {
|
|
325
|
+
background-color: var(--white);
|
|
326
|
+
border: var(--hairline) solid var(--gray-20);
|
|
327
|
+
box-shadow: var(--shadow-small);
|
|
328
|
+
color: var(--black);
|
|
329
|
+
display: flex;
|
|
330
|
+
flex: 1;
|
|
331
|
+
flex-direction: column;
|
|
332
|
+
height: 100%;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.visual-skeleton {
|
|
336
|
+
background-color: var(--gray-20);
|
|
337
|
+
height: var(--spacing-layout-7);
|
|
338
|
+
overflow: hidden;
|
|
339
|
+
position: relative;
|
|
340
|
+
width: 100%;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.content {
|
|
344
|
+
background-color: var(--white);
|
|
345
|
+
display: flex;
|
|
346
|
+
flex: 1;
|
|
347
|
+
flex-direction: column;
|
|
348
|
+
gap: var(--spacing-layout-half);
|
|
349
|
+
padding: var(--spacing-component-4);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.body {
|
|
353
|
+
display: flex;
|
|
354
|
+
flex: 1;
|
|
355
|
+
flex-direction: column;
|
|
356
|
+
gap: var(--spacing-layout-half);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.line {
|
|
360
|
+
background-color: var(--gray-20);
|
|
361
|
+
border-radius: var(--spacing-component-1);
|
|
362
|
+
display: block;
|
|
363
|
+
overflow: hidden;
|
|
364
|
+
position: relative;
|
|
365
|
+
width: 100%;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.line::after {
|
|
369
|
+
animation: shimmer 1.5s linear infinite;
|
|
370
|
+
background: linear-gradient(
|
|
371
|
+
90deg,
|
|
372
|
+
transparent 0%,
|
|
373
|
+
var(--white-50, rgba(255, 255, 255, 0.45)) 50%,
|
|
374
|
+
transparent 100%
|
|
375
|
+
);
|
|
376
|
+
content: "";
|
|
377
|
+
inset: 0;
|
|
378
|
+
position: absolute;
|
|
379
|
+
transform: translateX(-100%);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.line--eyebrow {
|
|
383
|
+
height: var(--line-height-small);
|
|
384
|
+
max-width: 28%;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.line--title {
|
|
388
|
+
height: var(--line-height-h3);
|
|
389
|
+
max-width: 76%;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.line--body {
|
|
393
|
+
height: var(--line-height-base);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.line--body-short {
|
|
397
|
+
max-width: 86%;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.line--action {
|
|
401
|
+
height: var(--line-height-small);
|
|
402
|
+
margin-block-start: auto;
|
|
403
|
+
max-width: 36%;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
@keyframes shimmer {
|
|
407
|
+
100% {
|
|
408
|
+
transform: translateX(100%);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
`,
|
|
412
|
+
];
|
|
413
|
+
|
|
414
|
+
render() {
|
|
415
|
+
return html`
|
|
416
|
+
<div class="card-skeleton" role="status" aria-busy="true" aria-label="Loading card">
|
|
417
|
+
<div class="visual-skeleton line" aria-hidden="true"></div>
|
|
418
|
+
<div class="content">
|
|
419
|
+
<div class="line line--eyebrow" aria-hidden="true"></div>
|
|
420
|
+
<div class="line line--title" aria-hidden="true"></div>
|
|
421
|
+
<div class="body" aria-hidden="true">
|
|
422
|
+
<div class="line line--body"></div>
|
|
423
|
+
<div class="line line--body line--body-short"></div>
|
|
424
|
+
<div class="line line--action"></div>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
`;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
404
432
|
if (!customElements.get("cfa-card")) {
|
|
405
433
|
customElements.define("cfa-card", Card);
|
|
406
434
|
}
|
|
435
|
+
|
|
436
|
+
if (!customElements.get("cfa-card-skeleton")) {
|
|
437
|
+
customElements.define("cfa-card-skeleton", CardSkeleton);
|
|
438
|
+
}
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
argTypes: {
|
|
7
7
|
theme: {
|
|
8
8
|
defaultValue: "default",
|
|
9
|
-
options: ["default"
|
|
9
|
+
options: ["default"],
|
|
10
10
|
control: { type: "radio" },
|
|
11
11
|
},
|
|
12
12
|
eyebrow: { type: "string" },
|
|
@@ -57,8 +57,8 @@ const Template = ({
|
|
|
57
57
|
eyebrow="${eyebrow}"
|
|
58
58
|
title="${title}"
|
|
59
59
|
label="${label}"
|
|
60
|
-
text
|
|
61
|
-
metaText
|
|
60
|
+
.text=${text}
|
|
61
|
+
.metaText=${metaText}
|
|
62
62
|
actionLabel="${actionLabel}"
|
|
63
63
|
>
|
|
64
64
|
</cfa-card>
|
|
@@ -71,7 +71,12 @@ Default.args = {
|
|
|
71
71
|
title: "Automatic Record Clearance",
|
|
72
72
|
label: "Now hiring",
|
|
73
73
|
text: "Working with state governments and communities to fundamentally transform the process of record clearance.",
|
|
74
|
-
metaText:
|
|
74
|
+
metaText: `
|
|
75
|
+
<ul class="ul ul--inline-with-separators">
|
|
76
|
+
<li>Updated May 7, 2026</li>
|
|
77
|
+
<li>In partnership with the community</li>
|
|
78
|
+
</ul>
|
|
79
|
+
`,
|
|
75
80
|
actionLabel: "Learn more",
|
|
76
81
|
linkUrl:
|
|
77
82
|
"https://codeforamerica.org/programs/criminal-justice/automatic-record-clearance/",
|
|
@@ -84,7 +89,7 @@ CardWithImage.args = {
|
|
|
84
89
|
title: "Food benefits",
|
|
85
90
|
label: "",
|
|
86
91
|
text: "Improving access to food assistance and delivery of benefits.",
|
|
87
|
-
metaText: "",
|
|
92
|
+
metaText: "Updated April 14, 2026",
|
|
88
93
|
linkUrl:
|
|
89
94
|
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
90
95
|
actionLabel: "Learn more",
|
|
@@ -112,59 +117,6 @@ CardWithLogo.args = {
|
|
|
112
117
|
visualAltText: "Code for America logo",
|
|
113
118
|
};
|
|
114
119
|
|
|
115
|
-
export const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
eyebrow: "Program",
|
|
119
|
-
title: "Food benefits",
|
|
120
|
-
label: "",
|
|
121
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
122
|
-
metaText: "",
|
|
123
|
-
linkUrl:
|
|
124
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
125
|
-
actionLabel: "Learn more",
|
|
126
|
-
visualType: "image",
|
|
127
|
-
visualUrl:
|
|
128
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
129
|
-
visualThumbnailUrl:
|
|
130
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
131
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const HorizontalCard = Template.bind({});
|
|
135
|
-
HorizontalCard.args = {
|
|
136
|
-
theme: "horizontal",
|
|
137
|
-
eyebrow: "Program",
|
|
138
|
-
title: "Food benefits",
|
|
139
|
-
label: "",
|
|
140
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
141
|
-
metaText: "",
|
|
142
|
-
linkUrl:
|
|
143
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
144
|
-
actionLabel: "Learn more",
|
|
145
|
-
visualType: "image",
|
|
146
|
-
visualUrl:
|
|
147
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
148
|
-
visualThumbnailUrl:
|
|
149
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
150
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const HorizontalCompactCard = Template.bind({});
|
|
154
|
-
HorizontalCompactCard.args = {
|
|
155
|
-
theme: "horizontal-compact",
|
|
156
|
-
eyebrow: "Program",
|
|
157
|
-
title: "Food benefits",
|
|
158
|
-
label: "",
|
|
159
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
160
|
-
metaText: "",
|
|
161
|
-
linkUrl:
|
|
162
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
163
|
-
actionLabel: "Learn more",
|
|
164
|
-
visualType: "image",
|
|
165
|
-
visualUrl:
|
|
166
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
167
|
-
visualThumbnailUrl:
|
|
168
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
169
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
170
|
-
};
|
|
120
|
+
export const SkeletonCard = () => html`
|
|
121
|
+
<cfa-card-skeleton></cfa-card-skeleton>
|
|
122
|
+
`;
|