@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,44 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Icon extends LitElement {
|
|
5
|
+
static styles = [
|
|
6
|
+
commonStyles,
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
--size: 1.2em;
|
|
10
|
+
|
|
11
|
+
display: inline;
|
|
12
|
+
line-height: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.icon {
|
|
16
|
+
-webkit-font-feature-settings: "liga";
|
|
17
|
+
direction: ltr;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
font-family: "Material Symbols Rounded";
|
|
20
|
+
font-size: var(--size);
|
|
21
|
+
font-style: normal;
|
|
22
|
+
font-weight: normal;
|
|
23
|
+
letter-spacing: normal;
|
|
24
|
+
margin-top: -0.1em;
|
|
25
|
+
text-transform: none;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
word-wrap: normal;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return html`
|
|
35
|
+
<span class="icon">
|
|
36
|
+
<slot></slot>
|
|
37
|
+
</span>
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!customElements.get("cfa-icon")) {
|
|
43
|
+
customElements.define("cfa-icon", Icon);
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.cfa-icon {
|
|
2
|
+
height: var(--spacing-layout-5);
|
|
3
|
+
margin-left: auto;
|
|
4
|
+
margin-right: auto;
|
|
5
|
+
width: var(--spacing-layout-5);
|
|
6
|
+
|
|
7
|
+
img {
|
|
8
|
+
display: block;
|
|
9
|
+
height: 100%;
|
|
10
|
+
object-fit: contain;
|
|
11
|
+
object-position: center center;
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Mixin
|
|
17
|
+
|
|
18
|
+
@mixin icon {
|
|
19
|
+
-webkit-font-feature-settings: 'liga';
|
|
20
|
+
direction: ltr;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
font-family: 'Material Symbols Rounded';
|
|
23
|
+
font-size: 1.4em;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: normal;
|
|
26
|
+
letter-spacing: normal;
|
|
27
|
+
text-transform: none;
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
margin-top: -0.1em;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
word-wrap: normal;
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./icon";
|
|
3
|
+
import { buttonStyles } from "./button";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Atoms/Icon",
|
|
7
|
+
argTypes: {
|
|
8
|
+
icon: { type: "string" },
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Template = ({ icon }) => html` <cfa-icon>${icon}</cfa-icon> `;
|
|
13
|
+
|
|
14
|
+
export const Default = Template.bind({});
|
|
15
|
+
Default.args = {
|
|
16
|
+
icon: "info",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const WithText = () => html`
|
|
20
|
+
<div>
|
|
21
|
+
<cfa-icon>info</cfa-icon>
|
|
22
|
+
<span>Important information</span>
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export const InButton = () => html`
|
|
27
|
+
<style>
|
|
28
|
+
${buttonStyles}
|
|
29
|
+
</style>
|
|
30
|
+
<button class="cfa-button cfa-button--primary">
|
|
31
|
+
Download File
|
|
32
|
+
<cfa-icon>download</cfa-icon>
|
|
33
|
+
</button>
|
|
34
|
+
<button class="cfa-button cfa-button--primary">
|
|
35
|
+
<cfa-icon>check_circle</cfa-icon>
|
|
36
|
+
Complete
|
|
37
|
+
</button>
|
|
38
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common.js";
|
|
3
|
+
import { typographyStyles } from "../shared/typography.js";
|
|
4
|
+
|
|
5
|
+
class Label extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
color: "",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
commonStyles,
|
|
12
|
+
typographyStyles,
|
|
13
|
+
css`
|
|
14
|
+
.label {
|
|
15
|
+
--background-color: var(--gray-20);
|
|
16
|
+
--text-color: var(--black, #000);
|
|
17
|
+
|
|
18
|
+
background-color: var(--background-color);
|
|
19
|
+
color: var(--text-color);
|
|
20
|
+
display: inline-block;
|
|
21
|
+
line-height: 1em;
|
|
22
|
+
padding: var(--spacing-component-2) var(--spacing-component-3);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.label[color="white"] {
|
|
26
|
+
--background-color: var(--white, #fff);
|
|
27
|
+
box-shadow: var(--shadow-small);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.label[color="purple"] {
|
|
31
|
+
--background-color: var(--purple-20);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.label[color="red"] {
|
|
35
|
+
--background-color: var(--red-20);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.label[color="blue"] {
|
|
39
|
+
--background-color: var(--blue-20);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label[color="green"] {
|
|
43
|
+
--background-color: var(--green-20);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.label[color="yellow"] {
|
|
47
|
+
--background-color: var(--yellow-20);
|
|
48
|
+
}
|
|
49
|
+
`,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return html`
|
|
54
|
+
<div class="label small strong" color="${this.color}">
|
|
55
|
+
<slot />
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!customElements.get("cfa-label")) {
|
|
62
|
+
customElements.define("cfa-label", Label);
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./label";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Atoms/Label",
|
|
6
|
+
argTypes: {
|
|
7
|
+
text: { type: "string" },
|
|
8
|
+
color: {
|
|
9
|
+
defaultValue: "default",
|
|
10
|
+
control: {
|
|
11
|
+
type: "radio",
|
|
12
|
+
options: ["default", "white", "purple", "red", "blue", "green"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Template = ({ text, color }) => html`
|
|
19
|
+
<cfa-label color="${color}"> ${text} </cfa-label>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const Default = Template.bind({});
|
|
23
|
+
Default.args = {
|
|
24
|
+
text: "Recording available",
|
|
25
|
+
color: "default",
|
|
26
|
+
};
|
|
27
|
+
Default.parameters = {
|
|
28
|
+
backgrounds: { default: "white" },
|
|
29
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.link-list,
|
|
2
|
+
ul.is-style-link-list, /* WordPress list style class */
|
|
3
|
+
.content ul.is-style-link-list /* WordPress list style class */
|
|
4
|
+
{
|
|
5
|
+
--bg-color: var(--white);
|
|
6
|
+
--bg-hover-color: var(--purple-10);
|
|
7
|
+
--border-color: var(--gray-40);
|
|
8
|
+
--border-hover-color: var(--purple-60);
|
|
9
|
+
--text-color: var(--black);
|
|
10
|
+
--text-hover-color: var(--purple-80);
|
|
11
|
+
--icon-color: var(--gray-40);
|
|
12
|
+
--icon-hover-color: var(--purple-60);
|
|
13
|
+
|
|
14
|
+
list-style: none;
|
|
15
|
+
padding: 0;
|
|
16
|
+
|
|
17
|
+
& > li {
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
& > li > a {
|
|
23
|
+
background-color: var(--bg-color);
|
|
24
|
+
border: var(--hairline) solid var(--border-color);
|
|
25
|
+
color: var(--text-color);
|
|
26
|
+
display: block;
|
|
27
|
+
padding: var(--spacing-component-3);
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
& > li > a:hover,
|
|
32
|
+
& > li > a:focus {
|
|
33
|
+
background-color: var(--bg-hover-color);
|
|
34
|
+
border-color: var(--border-hover-color);
|
|
35
|
+
color: var(--text-hover-color);
|
|
36
|
+
position: relative;
|
|
37
|
+
z-index: 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
& > li:first-child > a {
|
|
41
|
+
border-top-left-radius: var(--rounded-corners);
|
|
42
|
+
border-top-right-radius: var(--rounded-corners);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
& > li:last-child > a {
|
|
46
|
+
border-bottom-left-radius: var(--rounded-corners);
|
|
47
|
+
border-bottom-right-radius: var(--rounded-corners);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
& > li:not(:has(a)) {
|
|
51
|
+
background-color: var(--gray-20);
|
|
52
|
+
border: var(--hairline) solid var(--border-color);
|
|
53
|
+
color: var(--text-color);
|
|
54
|
+
display: block;
|
|
55
|
+
padding: var(--spacing-component-3);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& > li + li {
|
|
59
|
+
margin-block-start: calc(-1 * var(--hairline));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:has(cfa-icon) > li > a {
|
|
63
|
+
padding-left: var(--spacing-component-5);
|
|
64
|
+
position: relative;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
& > li > a cfa-icon {
|
|
68
|
+
color: var(--icon-color);
|
|
69
|
+
display: block;
|
|
70
|
+
left: var(--spacing-component-3);
|
|
71
|
+
position: absolute;
|
|
72
|
+
text-align: center;
|
|
73
|
+
width: var(--spacing-component-4);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
& > li > a:hover cfa-icon,
|
|
77
|
+
& > li > a:focus cfa-icon {
|
|
78
|
+
color: var(--icon-hover-color);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./link-list.scss";
|
|
3
|
+
import "./icon";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Molecules/LinkList",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = () => html`
|
|
10
|
+
<div class="container-fluid wrapper">
|
|
11
|
+
<div class="row center-md">
|
|
12
|
+
<div class="col-xs-12 col-md-6">
|
|
13
|
+
<ul class="link-list">
|
|
14
|
+
<li>
|
|
15
|
+
<a href="#">Best Practices for Data Aggregation in Summer EBT</a>
|
|
16
|
+
</li>
|
|
17
|
+
<li>
|
|
18
|
+
<a href="#">Tips for Working with Vendors</a>
|
|
19
|
+
</li>
|
|
20
|
+
<li>
|
|
21
|
+
<a href="#">
|
|
22
|
+
Tips for Creating a Human-Centered Summer EBT Application
|
|
23
|
+
</a>
|
|
24
|
+
</li>
|
|
25
|
+
</ul>
|
|
26
|
+
<br />
|
|
27
|
+
<ul class="link-list">
|
|
28
|
+
<li>
|
|
29
|
+
<a href="#">
|
|
30
|
+
<cfa-icon>favorite</cfa-icon> Best Practices for Data Aggregation
|
|
31
|
+
in Summer EBT
|
|
32
|
+
</a>
|
|
33
|
+
</li>
|
|
34
|
+
<li>
|
|
35
|
+
<a href="#">Tips for Working with Vendors </a>
|
|
36
|
+
</li>
|
|
37
|
+
<li>
|
|
38
|
+
<a href="#">
|
|
39
|
+
<cfa-icon>download</cfa-icon> Playbook: Tips for Creating a
|
|
40
|
+
Human-Centered Summer EBT Application
|
|
41
|
+
</a>
|
|
42
|
+
</li>
|
|
43
|
+
</ul>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
export const Default = Template.bind({});
|
|
50
|
+
Default.args = {
|
|
51
|
+
theme: "default",
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.cfa-loader {
|
|
2
|
+
--size: var(--spacing-component-3);
|
|
3
|
+
|
|
4
|
+
animation: pulse 2s infinite;
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
display: block;
|
|
7
|
+
height: var(--size);
|
|
8
|
+
margin-left: auto;
|
|
9
|
+
margin-right: auto;
|
|
10
|
+
text-indent: -9999px;
|
|
11
|
+
width: var(--size);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@keyframes pulse {
|
|
15
|
+
0% {
|
|
16
|
+
background-color: rgba(0,0,0,0);
|
|
17
|
+
}
|
|
18
|
+
50% {
|
|
19
|
+
background-color: rgba(0,0,0,0.3);
|
|
20
|
+
}
|
|
21
|
+
100% {
|
|
22
|
+
background-color: rgba(0,0,0,0);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./loader.scss";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Atoms/Loader",
|
|
6
|
+
argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = () => html`<div class="cfa-loader">Loading</div>`;
|
|
10
|
+
|
|
11
|
+
export const Default = Template.bind({});
|
|
12
|
+
Default.args = {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
import { typographyStyles } from "../shared/typography";
|
|
4
|
+
|
|
5
|
+
class LogoCard extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
name: {},
|
|
8
|
+
imageUrl: {},
|
|
9
|
+
linkUrl: {},
|
|
10
|
+
linkTarget: {},
|
|
11
|
+
};
|
|
12
|
+
static styles = [
|
|
13
|
+
commonStyles,
|
|
14
|
+
typographyStyles,
|
|
15
|
+
css`
|
|
16
|
+
:host {
|
|
17
|
+
--bg-color: var(--blue-20);
|
|
18
|
+
--text-color: var(--black);
|
|
19
|
+
|
|
20
|
+
align-items: stretch;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.card {
|
|
26
|
+
align-items: center;
|
|
27
|
+
background-color: var(--white);
|
|
28
|
+
border: var(--hairline) solid var(--black-10);
|
|
29
|
+
color: var(--text-color);
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
font-size: var(--font-size-h3);
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
line-height: var(--line-height-h4);
|
|
36
|
+
margin-inline: auto;
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
min-height: var(--spacing-layout-8);
|
|
39
|
+
padding: var(--spacing-component-5);
|
|
40
|
+
text-align: center;
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
transition: box-shadow 1s;
|
|
43
|
+
width: var(--column-span-4);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
a.card {
|
|
47
|
+
box-shadow: var(--shadow-small);
|
|
48
|
+
color: var(--text-color);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
a.card:hover {
|
|
52
|
+
box-shadow: var(--shadow-medium);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
img {
|
|
56
|
+
aspect-ratio: 2 / 1;
|
|
57
|
+
object-fit: contain;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
];
|
|
62
|
+
cardContentTemplate() {
|
|
63
|
+
let template;
|
|
64
|
+
if (this.imageUrl) {
|
|
65
|
+
template = html` <img src="${this.imageUrl}" alt="${this.name}" /> `;
|
|
66
|
+
} else {
|
|
67
|
+
template = html` ${this.name} `;
|
|
68
|
+
}
|
|
69
|
+
return template;
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return html`
|
|
73
|
+
${this.linkUrl
|
|
74
|
+
? html`
|
|
75
|
+
<a
|
|
76
|
+
href="${this.linkUrl}"
|
|
77
|
+
target="${this.linkTarget || "_self"}"
|
|
78
|
+
rel="${this.linkTarget == "_blank"
|
|
79
|
+
? "noopener noreferrer"
|
|
80
|
+
: nothing}"
|
|
81
|
+
class="card"
|
|
82
|
+
>
|
|
83
|
+
${this.cardContentTemplate()}
|
|
84
|
+
</a>
|
|
85
|
+
`
|
|
86
|
+
: html` <div class="card">${this.cardContentTemplate()}</div> `}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (!customElements.get("cfa-logo-card")) {
|
|
92
|
+
customElements.define("cfa-logo-card", LogoCard);
|
|
93
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./logo-card";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Molecules/LogoCard",
|
|
6
|
+
argTypes: {
|
|
7
|
+
name: { type: "string" },
|
|
8
|
+
imageUrl: { type: "string" },
|
|
9
|
+
linkUrl: { type: "string" },
|
|
10
|
+
linkTarget: { type: "string" },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = ({ name, imageUrl, linkUrl, linkTarget }) => html`
|
|
15
|
+
<cfa-logo-card
|
|
16
|
+
name="${name}"
|
|
17
|
+
imageUrl="${imageUrl}"
|
|
18
|
+
linkUrl="${linkUrl}"
|
|
19
|
+
linkTarget="${linkTarget}"
|
|
20
|
+
></cfa-logo-card>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({});
|
|
24
|
+
Default.args = {
|
|
25
|
+
name: "Code for America",
|
|
26
|
+
imageUrl:
|
|
27
|
+
"https://files.codeforamerica.org/2021/05/28124702/code-for-america-logo-black.svg",
|
|
28
|
+
linkUrl: "https://codeforamerica.org",
|
|
29
|
+
linkTarget: "_blank",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const LogoCardWithoutLink = Template.bind({});
|
|
33
|
+
LogoCardWithoutLink.args = {
|
|
34
|
+
name: "Code for America",
|
|
35
|
+
imageUrl:
|
|
36
|
+
"https://files.codeforamerica.org/2021/05/28124702/code-for-america-logo-black.svg",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const LogoCardWithoutImage = Template.bind({});
|
|
40
|
+
LogoCardWithoutImage.args = {
|
|
41
|
+
name: "Code for America",
|
|
42
|
+
linkUrl: "https://codeforamerica.org",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const LogoCardWithTextOnly = Template.bind({});
|
|
46
|
+
LogoCardWithTextOnly.args = {
|
|
47
|
+
name: "Code for America",
|
|
48
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Nav extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
fontSize: {},
|
|
7
|
+
};
|
|
8
|
+
static styles = [
|
|
9
|
+
commonStyles,
|
|
10
|
+
css`
|
|
11
|
+
:host {
|
|
12
|
+
--link-color: var(--purple-80);
|
|
13
|
+
--link-hover-color: var(--purple-80);
|
|
14
|
+
|
|
15
|
+
display: block;
|
|
16
|
+
font-family: var(--font-family-sans-serif);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
slot {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nav {
|
|
24
|
+
font-size: var(--font-size-base);
|
|
25
|
+
line-height: var(--line-height-base);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
nav[data-font-size="small"] {
|
|
29
|
+
font-size: var(--font-size-small);
|
|
30
|
+
line-height: var(--line-height-small);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
nav[data-font-size="large"] {
|
|
34
|
+
font-size: var(--font-size-h3);
|
|
35
|
+
line-height: var(--line-height-h3);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ul {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
gap: var(--spacing-component-1);
|
|
42
|
+
list-style: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
li {
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
li.is-active a {
|
|
54
|
+
box-shadow: inset 0 calc(-1 * var(--medium)) var(--link-hover-color);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a {
|
|
58
|
+
box-shadow: 0;
|
|
59
|
+
color: var(--link-color);
|
|
60
|
+
display: block;
|
|
61
|
+
font-weight: bold;
|
|
62
|
+
padding: var(--spacing-component-2) var(--spacing-component-3);
|
|
63
|
+
text-decoration: none;
|
|
64
|
+
transition: box-shadow 0.25s ease-in-out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
a:hover {
|
|
68
|
+
box-shadow: inset 0 calc(-1 * var(--medium)) var(--link-hover-color);
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
];
|
|
72
|
+
handleSlotchange(event) {
|
|
73
|
+
const slot = event.target;
|
|
74
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
75
|
+
const breadcrumbContainer = this.shadowRoot.querySelector("ul");
|
|
76
|
+
breadcrumbContainer.innerHTML = ""; // Clear the existing content
|
|
77
|
+
assignedNodes.forEach((node) => {
|
|
78
|
+
if (node.tagName === "UL") {
|
|
79
|
+
const liElements = node.querySelectorAll("li");
|
|
80
|
+
liElements.forEach((li) => {
|
|
81
|
+
breadcrumbContainer.appendChild(li.cloneNode(true));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
return html`
|
|
88
|
+
<slot @slotchange=${this.handleSlotchange}></slot>
|
|
89
|
+
<nav data-font-size="${this.fontSize}">
|
|
90
|
+
<ul></ul>
|
|
91
|
+
</nav>
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!customElements.get("cfa-nav")) {
|
|
97
|
+
customElements.define("cfa-nav", Nav);
|
|
98
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// TODO: Turn into web component, consider renaming (maybe 'navbar' or 'menu-bar'?)
|
|
2
|
+
|
|
3
|
+
import { html } from "lit-html";
|
|
4
|
+
import "./nav.js";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Molecules/Nav",
|
|
8
|
+
argTypes: {
|
|
9
|
+
fontSize: {
|
|
10
|
+
type: String,
|
|
11
|
+
control: "inline-radio",
|
|
12
|
+
options: ["small", "base", "large"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template = ({ fontSize }) => html`
|
|
18
|
+
<cfa-nav fontSize="${fontSize}">
|
|
19
|
+
<ul>
|
|
20
|
+
<li>
|
|
21
|
+
<a href="#"> Actions </a>
|
|
22
|
+
</li>
|
|
23
|
+
<li>
|
|
24
|
+
<a href="#"> Schedule </a>
|
|
25
|
+
</li>
|
|
26
|
+
<li>
|
|
27
|
+
<a href="#"> How to participate </a>
|
|
28
|
+
</li>
|
|
29
|
+
<li>
|
|
30
|
+
<a href="#"> FAQs </a>
|
|
31
|
+
</li>
|
|
32
|
+
</ul>
|
|
33
|
+
</cfa-nav>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const Default = Template.bind({});
|
|
37
|
+
Default.args = {
|
|
38
|
+
// font size
|
|
39
|
+
fontSize: "base",
|
|
40
|
+
};
|