@codeforamerica/marcomms-design-system 1.19.0 → 1.20.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/components/card.js +4 -0
- package/dist/components/label.js +4 -0
- package/dist/components/logo-card.js +4 -0
- package/dist/components/pager.js +7 -3
- package/dist/components/person-card.js +5 -1
- package/dist/components/promo.js +4 -0
- package/dist/components/stat.js +4 -0
- package/dist/components/tab-list.js +5 -1
- package/dist/components/tab.js +4 -0
- package/dist/components/tile.js +4 -0
- package/dist/components/transcript.js +4 -0
- package/dist/core.css +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/src/components/accordion.js +141 -0
- package/src/components/accordion.stories.js +56 -0
- package/src/components/avatar.js +62 -0
- package/src/components/avatar.stories.js +27 -0
- package/src/components/bar.js +102 -0
- package/src/components/bar.stories.js +22 -0
- package/src/components/blob.js +128 -0
- package/src/components/blob.stories.js +73 -0
- package/src/components/box.js +55 -0
- package/src/components/box.stories.js +24 -0
- package/src/components/breadcrumbs.js +80 -0
- package/src/components/breadcrumbs.stories.js +27 -0
- package/src/components/button.js +163 -0
- package/src/components/button.scss +157 -0
- package/src/components/button.stories.js +49 -0
- package/src/components/callout.js +62 -0
- package/src/components/callout.stories.js +20 -0
- package/src/components/card.js +456 -0
- package/src/components/card.stories.js +227 -0
- package/src/components/carousel.js +662 -0
- package/src/components/carousel.stories.js +165 -0
- package/src/components/details.scss +71 -0
- package/src/components/details.stories.js +27 -0
- package/src/components/form-elements.scss +304 -0
- package/src/components/form-elements.stories.js +134 -0
- package/src/components/icon.js +44 -0
- package/src/components/icon.scss +32 -0
- package/src/components/icon.stories.js +38 -0
- package/src/components/label.js +63 -0
- package/src/components/label.stories.js +29 -0
- package/src/components/link-list.scss +80 -0
- package/src/components/link-list.stories.js +52 -0
- package/src/components/loader.scss +24 -0
- package/src/components/loader.stories.js +12 -0
- package/src/components/logo-card.js +93 -0
- package/src/components/logo-card.stories.js +48 -0
- package/src/components/nav.js +98 -0
- package/src/components/nav.stories.js +40 -0
- package/src/components/page-nav.js +171 -0
- package/src/components/page-nav.stories.js +112 -0
- package/src/components/pager.js +98 -0
- package/src/components/pager.stories.js +30 -0
- package/src/components/pagination.js +116 -0
- package/src/components/pagination.stories.js +30 -0
- package/src/components/person-card.js +240 -0
- package/src/components/person-card.stories.js +58 -0
- package/src/components/pill.js +33 -0
- package/src/components/pill.stories.js +25 -0
- package/src/components/placeholder.js +25 -0
- package/src/components/placeholder.stories.js +10 -0
- package/src/components/promo.js +82 -0
- package/src/components/promo.stories.js +37 -0
- package/src/components/pullquote.js +42 -0
- package/src/components/pullquote.stories.js +16 -0
- package/src/components/quote.js +111 -0
- package/src/components/quote.stories.js +23 -0
- package/src/components/reveal.js +83 -0
- package/src/components/reveal.stories.js +40 -0
- package/src/components/slide.js +122 -0
- package/src/components/slide.stories.js +49 -0
- package/src/components/social-icon.js +236 -0
- package/src/components/social-icon.stories.js +36 -0
- package/src/components/stat.js +92 -0
- package/src/components/stat.stories.js +28 -0
- package/src/components/tab-list.js +114 -0
- package/src/components/tab-list.stories.js +18 -0
- package/src/components/tab.js +95 -0
- package/src/components/tab.stories.js +29 -0
- package/src/components/tile.js +149 -0
- package/src/components/tile.stories.js +41 -0
- package/src/components/transcript.js +44 -0
- package/src/components/transcript.stories.js +103 -0
- package/src/core/base.scss +86 -0
- package/src/core/colors.mdx +100 -0
- package/src/core/grid.mdx +244 -0
- package/src/core/grid.scss +394 -0
- package/src/core/helpers.scss +111 -0
- package/src/core/layout.scss +103 -0
- package/src/core/layout.stories.js +145 -0
- package/src/core/reset.scss +53 -0
- package/src/core/shadows.mdx +108 -0
- package/src/core/tokens.scss +261 -0
- package/src/core/typography.mdx +79 -0
- package/src/core/typography.scss +415 -0
- package/src/core.js +10 -0
- package/src/index.js +43 -0
- package/src/shared/common.js +65 -0
- package/src/shared/layout.js +14 -0
- package/src/shared/typography.js +401 -0
- package/src/styles.scss +15 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing, svg } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
import { typographyStyles } from "../shared/typography";
|
|
4
|
+
import "./label";
|
|
5
|
+
|
|
6
|
+
class Card extends LitElement {
|
|
7
|
+
static properties = {
|
|
8
|
+
theme: {},
|
|
9
|
+
linkUrl: {},
|
|
10
|
+
linkTarget: {},
|
|
11
|
+
visualType: {},
|
|
12
|
+
visualUrl: {},
|
|
13
|
+
visualThumbnailUrl: {},
|
|
14
|
+
visualAltText: {},
|
|
15
|
+
eyebrow: {},
|
|
16
|
+
label: {},
|
|
17
|
+
title: {},
|
|
18
|
+
text: {},
|
|
19
|
+
metaText: {},
|
|
20
|
+
actionLabel: {},
|
|
21
|
+
};
|
|
22
|
+
static styles = [
|
|
23
|
+
commonStyles,
|
|
24
|
+
typographyStyles,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
--action-border-color: var(--purple-20);
|
|
28
|
+
--action-border-hover-color: var(--red-60);
|
|
29
|
+
--action-text-color: var(--purple-60);
|
|
30
|
+
--action-text-hover-color: var(--red-60);
|
|
31
|
+
--bg-color: var(--white);
|
|
32
|
+
--padding: var(--spacing-component-4);
|
|
33
|
+
--text-color: var(--black);
|
|
34
|
+
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
margin-inline: auto;
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.card,
|
|
43
|
+
a.card {
|
|
44
|
+
box-shadow: var(--shadow-small);
|
|
45
|
+
border: var(--hairline) solid var(--gray-20);
|
|
46
|
+
color: var(--text-color);
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
flex: 1;
|
|
50
|
+
height: 100%;
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
transition: 500ms;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
a.card:hover {
|
|
56
|
+
--action-color: var(--action-hover-color);
|
|
57
|
+
|
|
58
|
+
box-shadow: var(--shadow-medium);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.content {
|
|
62
|
+
background-color: var(--bg-color);
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
flex-grow: 1;
|
|
66
|
+
gap: var(--spacing-layout-half);
|
|
67
|
+
padding: var(--padding);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.header {
|
|
71
|
+
align-items: start;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: var(--spacing-layout-half);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.body {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-flow: column nowrap;
|
|
80
|
+
flex-grow: 1;
|
|
81
|
+
gap: var(--spacing-layout-half);
|
|
82
|
+
height: 100%;
|
|
83
|
+
text-align: var(--text-alignment, start);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.footer {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: var(--spacing-layout-half);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.eyebrow {
|
|
93
|
+
color: var(--purple-60);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.eyebrow + * {
|
|
97
|
+
margin-block-start: var(--spacing-component-2);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.meta-text {
|
|
101
|
+
color: var(--gray-60);
|
|
102
|
+
border-block-start: var(--hairline) solid var(--gray-40);
|
|
103
|
+
padding-block-start: var(--spacing-component-2);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.card:has(.action-label) .meta-text {
|
|
107
|
+
border-block-end: var(--hairline) solid var(--gray-40);
|
|
108
|
+
padding-block-end: var(--spacing-component-2);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.action-label {
|
|
112
|
+
align-self: flex-start;
|
|
113
|
+
color: var(--action-text-color);
|
|
114
|
+
display: inline-block;
|
|
115
|
+
font-size: var(--font-size-small);
|
|
116
|
+
font-weight: bold;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
a:hover .action-label {
|
|
120
|
+
color: var(--action-text-hover-color);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.action-label::after {
|
|
124
|
+
background: linear-gradient(
|
|
125
|
+
to top,
|
|
126
|
+
var(--action-border-hover-color) 0% 50%,
|
|
127
|
+
var(--action-border-color) 50% 100%
|
|
128
|
+
);
|
|
129
|
+
background-position: 0% 0%;
|
|
130
|
+
background-size: 100% 200%;
|
|
131
|
+
content: "";
|
|
132
|
+
display: block;
|
|
133
|
+
height: var(--spacing-component-2);
|
|
134
|
+
transition: background-position 0.3s;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
a:hover .action-label::after {
|
|
138
|
+
background-position: 0% 100%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.visual {
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
display: flex;
|
|
144
|
+
height: auto;
|
|
145
|
+
height: var(--spacing-layout-7);
|
|
146
|
+
position: relative;
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
img {
|
|
151
|
+
height: 100%;
|
|
152
|
+
object-fit: cover;
|
|
153
|
+
width: 100%;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.fallback-image {
|
|
157
|
+
background-color: var(--purple-80);
|
|
158
|
+
position: absolute;
|
|
159
|
+
inline-start: 0;
|
|
160
|
+
block-start: 0;
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
z-index: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.fallback-image svg {
|
|
167
|
+
height: 100%;
|
|
168
|
+
width: 100%;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.visual picture {
|
|
172
|
+
position: relative;
|
|
173
|
+
z-index: 1;
|
|
174
|
+
width: 100%;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.image::after {
|
|
178
|
+
block-end: 0;
|
|
179
|
+
block-start: 0;
|
|
180
|
+
bottom: 0;
|
|
181
|
+
box-shadow: inset 0 -50px 50px -50px var(--black-60);
|
|
182
|
+
content: "";
|
|
183
|
+
inline-end: 0;
|
|
184
|
+
inline-start: 0;
|
|
185
|
+
position: absolute;
|
|
186
|
+
z-index: 2;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.logo {
|
|
190
|
+
background-color: var(--white, #fff);
|
|
191
|
+
box-sizing: border-box;
|
|
192
|
+
border-block-end: 1px solid var(--gray-20);
|
|
193
|
+
padding: var(--spacing-component-5);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.logo img {
|
|
197
|
+
object-fit: contain;
|
|
198
|
+
}
|
|
199
|
+
`,
|
|
200
|
+
];
|
|
201
|
+
visualTemplate() {
|
|
202
|
+
let template;
|
|
203
|
+
|
|
204
|
+
if (this.visualType === "image") {
|
|
205
|
+
template = html`
|
|
206
|
+
<div class="visual image">
|
|
207
|
+
<div class="fallback-image">
|
|
208
|
+
${svg`
|
|
209
|
+
<svg
|
|
210
|
+
width="1600"
|
|
211
|
+
height="900"
|
|
212
|
+
viewBox="0 0 1600 900"
|
|
213
|
+
fill="none"
|
|
214
|
+
preserveAspectRatio="xMinYMin slice"
|
|
215
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
216
|
+
>
|
|
217
|
+
<g clip-path="url(#clip0)">
|
|
218
|
+
<rect width="1600" height="900" fill="#2B1A78"/>
|
|
219
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1218.12 -444.87C1375.54 -448.403 1528.96 -379.695 1624.93 -254.874C1718.97 -132.569 1729.75 28.0324 1697.74 178.942C1664.98 333.396 1596.67 491.622 1452.8 556.721C1311.8 620.52 1155.18 556.724 1017.04 486.944C883.26 419.362 752.204 329.485 715.393 184.213C677.697 35.4535 737.759 -117.225 833.568 -237.116C929.253 -356.852 1064.86 -441.431 1218.12 -444.87Z" fill="#5650BE"/>
|
|
220
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M372.893 247.378C457.708 243.989 548.299 262.758 600.503 329.652C652.21 395.908 640.741 485.984 623.238 568.169C605.287 652.459 579.269 741.096 503.945 783.041C424.143 827.479 324.366 822.072 243.48 779.638C165.755 738.862 118.175 659.045 102.906 572.65C88.5877 491.632 114.457 410.294 167.015 346.974C218.23 285.272 292.743 250.581 372.893 247.378Z" fill="#5650BE"/>
|
|
221
|
+
</g>
|
|
222
|
+
<defs>
|
|
223
|
+
<clipPath id="clip0">
|
|
224
|
+
<rect width="1600" height="900" fill="white"/>
|
|
225
|
+
</clipPath>
|
|
226
|
+
</defs>
|
|
227
|
+
</svg>
|
|
228
|
+
`}
|
|
229
|
+
</div>
|
|
230
|
+
${this.visualUrl
|
|
231
|
+
? html`
|
|
232
|
+
<picture>
|
|
233
|
+
<source srcset="${this.visualUrl}" />
|
|
234
|
+
<img
|
|
235
|
+
src="${this.visualThumbnailUrl}"
|
|
236
|
+
alt="${this.visualAltText}"
|
|
237
|
+
loading="lazy"
|
|
238
|
+
onerror="this.style.display='none'"
|
|
239
|
+
/>
|
|
240
|
+
</picture>
|
|
241
|
+
`
|
|
242
|
+
: nothing}
|
|
243
|
+
</div>
|
|
244
|
+
`;
|
|
245
|
+
} else if (this.visualType === "logo") {
|
|
246
|
+
template = html`
|
|
247
|
+
<div class="visual logo">
|
|
248
|
+
<picture>
|
|
249
|
+
<source srcset="${this.visualUrl}" />
|
|
250
|
+
<img
|
|
251
|
+
src="${this.visualThumbnailUrl}"
|
|
252
|
+
alt="${this.visualAltText}"
|
|
253
|
+
loading="lazy"
|
|
254
|
+
/>
|
|
255
|
+
</picture>
|
|
256
|
+
</div>
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
return template;
|
|
260
|
+
}
|
|
261
|
+
cardContentTemplate() {
|
|
262
|
+
return html`
|
|
263
|
+
${this.visualTemplate()}
|
|
264
|
+
<div class="content">
|
|
265
|
+
<div class="header">
|
|
266
|
+
<div>
|
|
267
|
+
${this.eyebrow
|
|
268
|
+
? html` <div class="eyebrow">${this.eyebrow}</div> `
|
|
269
|
+
: nothing}
|
|
270
|
+
${this.title
|
|
271
|
+
? html` <div class="h3 title">${this.title}</div> `
|
|
272
|
+
: nothing}
|
|
273
|
+
</div>
|
|
274
|
+
${this.label
|
|
275
|
+
? html`
|
|
276
|
+
<div>
|
|
277
|
+
<cfa-label color="green">${this.label}</cfa-label>
|
|
278
|
+
</div>
|
|
279
|
+
`
|
|
280
|
+
: nothing}
|
|
281
|
+
</div>
|
|
282
|
+
<div class="body">
|
|
283
|
+
${this.text
|
|
284
|
+
? html` <div class="small" .innerHTML=${this.text}></div> `
|
|
285
|
+
: nothing}
|
|
286
|
+
</div>
|
|
287
|
+
${(this.metaText || this.actionLabel)
|
|
288
|
+
? html`
|
|
289
|
+
<div class="footer">
|
|
290
|
+
${this.metaText
|
|
291
|
+
? html`
|
|
292
|
+
<div
|
|
293
|
+
class="meta-text small"
|
|
294
|
+
.innerHTML=${this.metaText}
|
|
295
|
+
></div>
|
|
296
|
+
`
|
|
297
|
+
: nothing}
|
|
298
|
+
${this.actionLabel
|
|
299
|
+
? html` <div class="action-label">${this.actionLabel}</div> `
|
|
300
|
+
: nothing}
|
|
301
|
+
</div>
|
|
302
|
+
`
|
|
303
|
+
: nothing}
|
|
304
|
+
</div>
|
|
305
|
+
`;
|
|
306
|
+
}
|
|
307
|
+
render() {
|
|
308
|
+
return html`
|
|
309
|
+
${this.linkUrl
|
|
310
|
+
? html`
|
|
311
|
+
<a
|
|
312
|
+
href="${this.linkUrl}"
|
|
313
|
+
target="${this.linkTarget}"
|
|
314
|
+
rel="${this.linkTarget == "_blank" ? "noopener" : nothing}"
|
|
315
|
+
class="card ${this.theme ? "card--" + this.theme : ""}"
|
|
316
|
+
>
|
|
317
|
+
${this.cardContentTemplate()}
|
|
318
|
+
</a>
|
|
319
|
+
`
|
|
320
|
+
: html`
|
|
321
|
+
<div class="card ${this.theme ? "card--" + this.theme : ""}">
|
|
322
|
+
${this.cardContentTemplate()}
|
|
323
|
+
</div>
|
|
324
|
+
`}
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
class CardSkeleton extends LitElement {
|
|
330
|
+
static styles = [
|
|
331
|
+
commonStyles,
|
|
332
|
+
typographyStyles,
|
|
333
|
+
css`
|
|
334
|
+
:host {
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
margin-inline: auto;
|
|
338
|
+
max-width: 100%;
|
|
339
|
+
width: 100%;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.card-skeleton {
|
|
343
|
+
background-color: var(--white);
|
|
344
|
+
border: var(--hairline) solid var(--gray-20);
|
|
345
|
+
box-shadow: var(--shadow-small);
|
|
346
|
+
color: var(--black);
|
|
347
|
+
display: flex;
|
|
348
|
+
flex: 1;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
height: 100%;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.visual-skeleton {
|
|
354
|
+
background-color: var(--gray-20);
|
|
355
|
+
height: var(--spacing-layout-7);
|
|
356
|
+
overflow: hidden;
|
|
357
|
+
position: relative;
|
|
358
|
+
width: 100%;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.content {
|
|
362
|
+
background-color: var(--white);
|
|
363
|
+
display: flex;
|
|
364
|
+
flex: 1;
|
|
365
|
+
flex-direction: column;
|
|
366
|
+
gap: var(--spacing-layout-half);
|
|
367
|
+
padding: var(--spacing-component-4);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.body {
|
|
371
|
+
display: flex;
|
|
372
|
+
flex: 1;
|
|
373
|
+
flex-direction: column;
|
|
374
|
+
gap: var(--spacing-layout-half);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.line {
|
|
378
|
+
background-color: var(--gray-20);
|
|
379
|
+
border-radius: var(--spacing-component-1);
|
|
380
|
+
display: block;
|
|
381
|
+
overflow: hidden;
|
|
382
|
+
position: relative;
|
|
383
|
+
width: 100%;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.line::after {
|
|
387
|
+
animation: shimmer 1.5s linear infinite;
|
|
388
|
+
background: linear-gradient(
|
|
389
|
+
90deg,
|
|
390
|
+
transparent 0%,
|
|
391
|
+
var(--white-50, rgba(255, 255, 255, 0.45)) 50%,
|
|
392
|
+
transparent 100%
|
|
393
|
+
);
|
|
394
|
+
content: "";
|
|
395
|
+
inset: 0;
|
|
396
|
+
position: absolute;
|
|
397
|
+
transform: translateX(-100%);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.line--eyebrow {
|
|
401
|
+
height: var(--line-height-small);
|
|
402
|
+
max-width: 28%;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.line--title {
|
|
406
|
+
height: var(--line-height-h3);
|
|
407
|
+
max-width: 76%;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.line--body {
|
|
411
|
+
height: var(--line-height-base);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.line--body-short {
|
|
415
|
+
max-width: 86%;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.line--action {
|
|
419
|
+
height: var(--line-height-small);
|
|
420
|
+
margin-block-start: auto;
|
|
421
|
+
max-width: 36%;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
@keyframes shimmer {
|
|
425
|
+
100% {
|
|
426
|
+
transform: translateX(100%);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
`,
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
render() {
|
|
433
|
+
return html`
|
|
434
|
+
<div class="card-skeleton" role="status" aria-busy="true" aria-label="Loading card">
|
|
435
|
+
<div class="visual-skeleton line" aria-hidden="true"></div>
|
|
436
|
+
<div class="content">
|
|
437
|
+
<div class="line line--eyebrow" aria-hidden="true"></div>
|
|
438
|
+
<div class="line line--title" aria-hidden="true"></div>
|
|
439
|
+
<div class="body" aria-hidden="true">
|
|
440
|
+
<div class="line line--body"></div>
|
|
441
|
+
<div class="line line--body line--body-short"></div>
|
|
442
|
+
<div class="line line--action"></div>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
`;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (!customElements.get("cfa-card")) {
|
|
451
|
+
customElements.define("cfa-card", Card);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (!customElements.get("cfa-card-skeleton")) {
|
|
455
|
+
customElements.define("cfa-card-skeleton", CardSkeleton);
|
|
456
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./card";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Molecules/Card",
|
|
6
|
+
argTypes: {
|
|
7
|
+
theme: {
|
|
8
|
+
defaultValue: "default",
|
|
9
|
+
options: ["default"],
|
|
10
|
+
control: { type: "radio" },
|
|
11
|
+
},
|
|
12
|
+
eyebrow: { type: "string" },
|
|
13
|
+
title: { type: "string" },
|
|
14
|
+
label: { type: "string" },
|
|
15
|
+
text: { type: "string" },
|
|
16
|
+
metaText: { type: "string" },
|
|
17
|
+
linkUrl: { type: "string" },
|
|
18
|
+
linkTarget: {
|
|
19
|
+
defaultValue: "_self",
|
|
20
|
+
options: ["_self", "_blank"],
|
|
21
|
+
control: { type: "radio" },
|
|
22
|
+
},
|
|
23
|
+
actionLabel: { type: "string" },
|
|
24
|
+
visualType: {
|
|
25
|
+
defaultValue: "none",
|
|
26
|
+
options: ["none", "image", "logo"],
|
|
27
|
+
control: { type: "radio" },
|
|
28
|
+
},
|
|
29
|
+
visualUrl: { type: "string" },
|
|
30
|
+
visualAltText: { type: "string" },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const Template = ({
|
|
35
|
+
theme,
|
|
36
|
+
eyebrow,
|
|
37
|
+
title,
|
|
38
|
+
label,
|
|
39
|
+
text,
|
|
40
|
+
metaText,
|
|
41
|
+
linkUrl,
|
|
42
|
+
linkTarget,
|
|
43
|
+
actionLabel,
|
|
44
|
+
visualType,
|
|
45
|
+
visualUrl,
|
|
46
|
+
visualThumbnailUrl,
|
|
47
|
+
visualAltText,
|
|
48
|
+
}) => html`
|
|
49
|
+
<cfa-card
|
|
50
|
+
theme="${theme}"
|
|
51
|
+
linkUrl="${linkUrl}"
|
|
52
|
+
linkTarget="${linkTarget}"
|
|
53
|
+
visualType="${visualType}"
|
|
54
|
+
visualUrl="${visualUrl}"
|
|
55
|
+
visualThumbnailUrl="${visualThumbnailUrl}"
|
|
56
|
+
visualAltText="${visualAltText}"
|
|
57
|
+
eyebrow="${eyebrow}"
|
|
58
|
+
title="${title}"
|
|
59
|
+
label="${label}"
|
|
60
|
+
.text=${text}
|
|
61
|
+
.metaText=${metaText}
|
|
62
|
+
actionLabel="${actionLabel}"
|
|
63
|
+
>
|
|
64
|
+
</cfa-card>
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const Default = Template.bind({});
|
|
68
|
+
Default.args = {
|
|
69
|
+
theme: "default",
|
|
70
|
+
eyebrow: "Program",
|
|
71
|
+
title: "Automatic Record Clearance",
|
|
72
|
+
label: "Now hiring",
|
|
73
|
+
text: "Working with state governments and communities to fundamentally transform the process of record clearance.",
|
|
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
|
+
`,
|
|
80
|
+
actionLabel: "Learn more",
|
|
81
|
+
linkUrl:
|
|
82
|
+
"https://codeforamerica.org/programs/criminal-justice/automatic-record-clearance/",
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const CardWithImage = Template.bind({});
|
|
86
|
+
CardWithImage.args = {
|
|
87
|
+
theme: "default",
|
|
88
|
+
eyebrow: "Program",
|
|
89
|
+
title: "Food benefits",
|
|
90
|
+
label: "",
|
|
91
|
+
text: "Improving access to food assistance and delivery of benefits.",
|
|
92
|
+
metaText: "Updated April 14, 2026",
|
|
93
|
+
linkUrl:
|
|
94
|
+
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
95
|
+
actionLabel: "",
|
|
96
|
+
visualType: "image",
|
|
97
|
+
visualUrl:
|
|
98
|
+
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
99
|
+
visualThumbnailUrl:
|
|
100
|
+
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
101
|
+
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const CardWithLogo = Template.bind({});
|
|
105
|
+
CardWithLogo.args = {
|
|
106
|
+
theme: "default",
|
|
107
|
+
eyebrow: "Partner",
|
|
108
|
+
title: "Code for America",
|
|
109
|
+
label: "Accepting applications",
|
|
110
|
+
text: "",
|
|
111
|
+
metaText: "",
|
|
112
|
+
linkUrl: "https://codeforamerica.org",
|
|
113
|
+
actionLabel: "Learn more",
|
|
114
|
+
visualType: "logo",
|
|
115
|
+
visualUrl:
|
|
116
|
+
"https://files.codeforamerica.org/2021/05/28124702/code-for-america-logo-black.svg",
|
|
117
|
+
visualAltText: "Code for America logo",
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const SkeletonCard = () => html`
|
|
121
|
+
<cfa-card-skeleton></cfa-card-skeleton>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
export const CardLayoutExample = () => html`
|
|
125
|
+
<div class="container-fluid wrapper">
|
|
126
|
+
<div class="row stretch-md">
|
|
127
|
+
<div class="col-xs-12 col-md-4">
|
|
128
|
+
${Template({
|
|
129
|
+
theme: "default",
|
|
130
|
+
eyebrow: "Program",
|
|
131
|
+
title: "Automatic Record Clearance",
|
|
132
|
+
label: "Now hiring",
|
|
133
|
+
text: "Working with state governments and communities to fundamentally transform the process of record clearance.",
|
|
134
|
+
metaText: `
|
|
135
|
+
<ul class="ul ul--inline-with-separators">
|
|
136
|
+
<li>Updated May 7, 2026</li>
|
|
137
|
+
<li>In partnership with the community</li>
|
|
138
|
+
</ul>
|
|
139
|
+
`,
|
|
140
|
+
actionLabel: "Learn more",
|
|
141
|
+
linkUrl: "https://codeforamerica.org/programs/criminal-justice/automatic-record-clearance/",
|
|
142
|
+
})}
|
|
143
|
+
</div>
|
|
144
|
+
<div class="col-xs-12 col-md-4">
|
|
145
|
+
${Template({
|
|
146
|
+
theme: "default",
|
|
147
|
+
eyebrow: "Program",
|
|
148
|
+
title: "Food benefits",
|
|
149
|
+
label: "",
|
|
150
|
+
text: "Improving access to food assistance and delivery of benefits.",
|
|
151
|
+
metaText: "Updated April 14, 2026",
|
|
152
|
+
linkUrl: "https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
153
|
+
actionLabel: "",
|
|
154
|
+
visualType: "image",
|
|
155
|
+
visualUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
156
|
+
visualThumbnailUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
157
|
+
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
158
|
+
})}
|
|
159
|
+
</div>
|
|
160
|
+
<div class="col-xs-12 col-md-4">
|
|
161
|
+
${Template({
|
|
162
|
+
theme: "default",
|
|
163
|
+
eyebrow: "Partner",
|
|
164
|
+
title: "Code for America",
|
|
165
|
+
label: "Accepting applications",
|
|
166
|
+
text: "",
|
|
167
|
+
metaText: "",
|
|
168
|
+
linkUrl: "https://codeforamerica.org",
|
|
169
|
+
actionLabel: "Learn more",
|
|
170
|
+
visualType: "logo",
|
|
171
|
+
visualUrl: "https://files.codeforamerica.org/2021/05/28124702/code-for-america-logo-black.svg",
|
|
172
|
+
visualAltText: "Code for America logo",
|
|
173
|
+
})}
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="row stretch-md">
|
|
177
|
+
<div class="col-xs-12 col-md-4">
|
|
178
|
+
${Template({
|
|
179
|
+
theme: "default",
|
|
180
|
+
eyebrow: "Initiative",
|
|
181
|
+
title: "Voter Registration",
|
|
182
|
+
label: "",
|
|
183
|
+
text: "Helping eligible citizens register to vote.",
|
|
184
|
+
metaText: "Updated March 15, 2026",
|
|
185
|
+
linkUrl: "https://codeforamerica.org",
|
|
186
|
+
actionLabel: "",
|
|
187
|
+
visualType: "image",
|
|
188
|
+
visualUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
189
|
+
visualThumbnailUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
190
|
+
visualAltText: "Illustration representing voting",
|
|
191
|
+
})}
|
|
192
|
+
</div>
|
|
193
|
+
<div class="col-xs-12 col-md-4">
|
|
194
|
+
${Template({
|
|
195
|
+
theme: "default",
|
|
196
|
+
eyebrow: "Service",
|
|
197
|
+
title: "Benefits Enrollment",
|
|
198
|
+
label: "",
|
|
199
|
+
text: "Streamlining the process for residents to access vital benefits they qualify for. We work directly with state and local agencies to simplify enrollment workflows.",
|
|
200
|
+
metaText: "Updated February 28, 2026",
|
|
201
|
+
linkUrl: "https://codeforamerica.org",
|
|
202
|
+
actionLabel: "",
|
|
203
|
+
visualType: "image",
|
|
204
|
+
visualUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
205
|
+
visualThumbnailUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
206
|
+
visualAltText: "Illustration representing enrollment",
|
|
207
|
+
})}
|
|
208
|
+
</div>
|
|
209
|
+
<div class="col-xs-12 col-md-4">
|
|
210
|
+
${Template({
|
|
211
|
+
theme: "default",
|
|
212
|
+
eyebrow: "Program",
|
|
213
|
+
title: "Health Access Initiative",
|
|
214
|
+
label: "",
|
|
215
|
+
text: "Connecting communities with healthcare resources.",
|
|
216
|
+
metaText: "Coming in June 2026",
|
|
217
|
+
linkUrl: "https://codeforamerica.org",
|
|
218
|
+
actionLabel: "",
|
|
219
|
+
visualType: "image",
|
|
220
|
+
visualUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
221
|
+
visualThumbnailUrl: "https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
222
|
+
visualAltText: "Illustration representing health",
|
|
223
|
+
})}
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
`;
|