@codeforamerica/marcomms-design-system 1.0.0 → 1.1.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.
Files changed (92) hide show
  1. package/dist/styles.css +1 -1
  2. package/package.json +2 -1
  3. package/src/components/accordion.js +141 -0
  4. package/src/components/accordion.stories.js +56 -0
  5. package/src/components/avatar.js +62 -0
  6. package/src/components/avatar.stories.js +27 -0
  7. package/src/components/banner.js +152 -0
  8. package/src/components/banner.stories.js +115 -0
  9. package/src/components/bar.js +102 -0
  10. package/src/components/bar.stories.js +22 -0
  11. package/src/components/blob.js +119 -0
  12. package/src/components/blob.stories.js +64 -0
  13. package/src/components/box.js +55 -0
  14. package/src/components/box.stories.js +24 -0
  15. package/src/components/breadcrumbs.js +80 -0
  16. package/src/components/breadcrumbs.stories.js +27 -0
  17. package/src/components/button.js +167 -0
  18. package/src/components/button.scss +162 -0
  19. package/src/components/button.stories.js +49 -0
  20. package/src/components/callout.js +62 -0
  21. package/src/components/callout.stories.js +20 -0
  22. package/src/components/card.js +403 -0
  23. package/src/components/card.stories.js +170 -0
  24. package/src/components/carousel.js +182 -0
  25. package/src/components/carousel.stories.js +61 -0
  26. package/src/components/cta.js +99 -0
  27. package/src/components/cta.stories.js +22 -0
  28. package/src/components/details.scss +71 -0
  29. package/src/components/details.stories.js +27 -0
  30. package/src/components/flexible-layout.js +126 -0
  31. package/src/components/flexible-layout.stories.js +48 -0
  32. package/src/components/form-elements.scss +305 -0
  33. package/src/components/form-elements.stories.js +134 -0
  34. package/src/components/icon.js +41 -0
  35. package/src/components/icon.scss +31 -0
  36. package/src/components/icon.stories.js +16 -0
  37. package/src/components/label.js +63 -0
  38. package/src/components/label.stories.js +29 -0
  39. package/src/components/link-list.scss +80 -0
  40. package/src/components/link-list.stories.js +52 -0
  41. package/src/components/loader.scss +24 -0
  42. package/src/components/loader.stories.js +12 -0
  43. package/src/components/logo-card.js +93 -0
  44. package/src/components/logo-card.stories.js +48 -0
  45. package/src/components/nav.js +99 -0
  46. package/src/components/nav.stories.js +40 -0
  47. package/src/components/page-nav.js +171 -0
  48. package/src/components/page-nav.stories.js +112 -0
  49. package/src/components/pager.js +98 -0
  50. package/src/components/pager.stories.js +30 -0
  51. package/src/components/pagination.js +116 -0
  52. package/src/components/pagination.stories.js +30 -0
  53. package/src/components/person-card.js +240 -0
  54. package/src/components/person-card.stories.js +58 -0
  55. package/src/components/pill.js +33 -0
  56. package/src/components/pill.stories.js +23 -0
  57. package/src/components/promo.js +83 -0
  58. package/src/components/promo.stories.js +37 -0
  59. package/src/components/pullquote.js +42 -0
  60. package/src/components/pullquote.stories.js +16 -0
  61. package/src/components/quote.js +84 -0
  62. package/src/components/quote.stories.js +23 -0
  63. package/src/components/reveal.js +83 -0
  64. package/src/components/reveal.stories.js +40 -0
  65. package/src/components/slide.js +121 -0
  66. package/src/components/slide.stories.js +53 -0
  67. package/src/components/social-icon.js +233 -0
  68. package/src/components/social-icon.stories.js +36 -0
  69. package/src/components/stat.js +92 -0
  70. package/src/components/stat.stories.js +28 -0
  71. package/src/components/tab-list.js +114 -0
  72. package/src/components/tab-list.stories.js +18 -0
  73. package/src/components/tab.js +95 -0
  74. package/src/components/tab.stories.js +29 -0
  75. package/src/components/tile.js +150 -0
  76. package/src/components/tile.stories.js +41 -0
  77. package/src/components/transcript.js +44 -0
  78. package/src/components/transcript.stories.js +167 -0
  79. package/src/core/base.scss +86 -0
  80. package/src/core/colors.mdx +100 -0
  81. package/src/core/grid.mdx +14 -0
  82. package/src/core/grid.scss +295 -0
  83. package/src/core/helpers.scss +111 -0
  84. package/src/core/layout.scss +79 -0
  85. package/src/core/reset.scss +53 -0
  86. package/src/core/tokens.scss +251 -0
  87. package/src/core/typography.mdx +66 -0
  88. package/src/core/typography.scss +426 -0
  89. package/src/shared/common.js +15 -0
  90. package/src/shared/layout.js +14 -0
  91. package/src/shared/typography.js +111 -0
  92. package/src/styles.scss +15 -0
@@ -0,0 +1,251 @@
1
+ @use 'grid';
2
+
3
+ :root {
4
+
5
+ // Color
6
+
7
+ --black: #000;
8
+ --white: #fff;
9
+
10
+ --black-10: rgba(0,0,0,0.1);
11
+ --black-20: rgba(0,0,0,0.2);
12
+ --black-40: rgba(0,0,0,0.4);
13
+ --black-60: rgba(0,0,0,0.6);
14
+ --black-80: rgba(0,0,0,0.8);
15
+
16
+ --white-20: rgba(255,255,255,0.2);
17
+ --white-40: rgba(255,255,255,0.4);
18
+ --white-60: rgba(255,255,255,0.6);
19
+ --white-80: rgba(255,255,255,0.8);
20
+
21
+ --gray-20: #ececec;
22
+ --gray-40: #b4b4b4;
23
+ --gray-60: #555555;
24
+ --gray-80: #292929;
25
+
26
+ --purple-10: #f4f4fb;
27
+ --purple-20: #DBDAF1;
28
+ --purple-40: #ADA9FF;
29
+ --purple-60: #4B49B2;
30
+ --purple-80: #2B1A78;
31
+
32
+ --red-20: #FBDADC;
33
+ --red-40: #FF999F;
34
+ --red-60: #AF121D;
35
+ --red-80: #5C0A0F;
36
+
37
+ --blue-20: #E6EBF9;
38
+ --blue-40: #B3C7FF;
39
+ --blue-60: #7595F0;
40
+ --blue-80: #172C68;
41
+
42
+ --yellow-20: #FFEBCC;
43
+ --yellow-40: #FFD699;
44
+ --yellow-60: #F2AA40;
45
+ --yellow-80: #663D00;
46
+
47
+ --green-20: #D6F5ED;
48
+ --green-40: #ADF0E0;
49
+ --green-60: #39AA8E;
50
+ --green-80: #004239;
51
+
52
+ --sand-20: #F5F0ED;
53
+ --sand-40: #F8D5BF;
54
+ --sand-60: #C19F8B;
55
+ --sand-80: #3D3129;
56
+
57
+ --brand-purple: var(--purple-80);
58
+ --brand-red: var(--red-60);
59
+
60
+ --accent-color: var(--purple-60);
61
+
62
+ --text-color: var(--black);
63
+
64
+ --base-link-color: var(--purple-80);
65
+ --base-link-hover-color: var(--red-60);
66
+
67
+ --link-color: var(--base-link-color);
68
+ --link-hover-color: var(--base-link-hover-color);
69
+
70
+ // =====
71
+
72
+ // Spacing
73
+
74
+ /* Layout spacing (based on REM) */
75
+
76
+ --spacing-layout-0: 0;
77
+ --spacing-layout-half: 0.75rem;
78
+ --spacing-layout-1: 1.5rem;
79
+ --spacing-layout-2: 3rem;
80
+ --spacing-layout-3: 4.5rem;
81
+ --spacing-layout-4: 6rem;
82
+ --spacing-layout-5: 7.5rem;
83
+ --spacing-layout-6: 9rem;
84
+ --spacing-layout-7: 10.5rem;
85
+ --spacing-layout-8: 12rem;
86
+ --spacing-layout-9: 13.5rem;
87
+
88
+ /* Component spacing (based on PX) */
89
+
90
+ --spacing-component-0: 0;
91
+ --spacing-component-1: 4px;
92
+ --spacing-component-2: 8px;
93
+ --spacing-component-3: 16px;
94
+ --spacing-component-4: 32px;
95
+ --spacing-component-5: 64px;
96
+ --spacing-component-6: 128px;
97
+ --spacing-component-7: 256px;
98
+ --spacing-component-8: 512px;
99
+ --spacing-component-9: 1024px;
100
+
101
+ // =====
102
+
103
+ // Layout and grid
104
+
105
+ /* Breakpoints */
106
+
107
+ --breakpoint-mobile: 480px;
108
+ --breakpoint-tablet: 768px;
109
+ --breakpoint-desktop: 1024px;
110
+ --breakpoint-widescreen: 1600px;
111
+
112
+ /* Layout */
113
+
114
+ --gutter-width: var(--spacing-layout-1);
115
+ --outer-margin: var(--spacing-layout-1);
116
+ --grid-max-width: 1200px;
117
+ --grid-max-width-wp: calc(var(--grid-max-width) - var(--outer-margin) * 2);
118
+
119
+ /* Column sizes */
120
+
121
+ @for $i from 1 through 12 {
122
+ --column-span-#{$i}: #{grid.column-span($i)};
123
+ }
124
+
125
+ // =====
126
+
127
+ // Typography
128
+
129
+ --font-family-serif: 'Source Serif 4', serif;
130
+ --font-family-sans-serif: 'Source Sans 3', sans-serif;
131
+
132
+ --font-family-base: var(--font-family-sans-serif);
133
+ --font-family-heading: var(--font-family-serif);
134
+ --font-family-display-1: var(--font-family-heading);
135
+ --font-family-display-2: var(--font-family-heading);
136
+ --font-family-h1: var(--font-family-heading);
137
+ --font-family-h2: var(--font-family-heading);
138
+ --font-family-h3: var(--font-family-heading);
139
+ --font-family-h4: var(--font-family-heading);
140
+ --font-family-eyebrow: var(--base-font-family);
141
+
142
+ --font-size-base: 20px;
143
+ --font-size-display-1: 3.052rem; // 61.04px
144
+ --font-size-display-2: 2.441rem; // 48.83px
145
+ --font-size-h1: 1.953rem; // 39.06px
146
+ --font-size-h2: 1.563rem; // 31.25px
147
+ --font-size-h3: 1.25rem; // 25px
148
+ --font-size-h4: 1rem; // 20px
149
+ --font-size-eyebrow: 0.7rem; // 16px
150
+ --font-size-extra-large: var(--font-size-h2);
151
+ --font-size-large: var(--font-size-h3);
152
+ --font-size-small: 0.8rem;
153
+
154
+ // Font size aliases
155
+ --font-size-sm: var(--font-size-small);
156
+ --font-size-md: var(--font-size-base);
157
+ --font-size-lg: var(--font-size-large);
158
+ --font-size-xl: var(--font-size-extra-large);
159
+ --font-size-xxl: var(--font-size-display-2);
160
+ --font-size-xxxl: var(--font-size-display-1);
161
+
162
+ --font-weight-regular: 400;
163
+ --font-weight-bold: 700;
164
+ --font-weight-display-1: var(--font-weight-bold);
165
+ --font-weight-display-2: var(--font-weight-bold);
166
+ --font-weight-h1: var(--font-weight-bold);
167
+ --font-weight-h2: var(--font-weight-bold);
168
+ --font-weight-h3: var(--font-weight-bold);
169
+ --font-weight-h4: var(--font-weight-bold);
170
+ --font-weight-eyebrow: var(--font-weight-bold);
171
+
172
+ --line-height-base: calc(1.5 * var(--font-size-base, 20px));
173
+ --line-height-display-1: 1.2em;
174
+ --line-height-display-2: 1.2em;
175
+ --line-height-h1: 1.2em;
176
+ --line-height-h2: 1.2em;
177
+ --line-height-h3: 1.3em;
178
+ --line-height-h4: 1.3em;
179
+ --line-height-eyebrow: 1em;
180
+ --line-height-extra-large: var(--line-height-h2);
181
+ --line-height-large: var(--line-height-h3);
182
+ --line-height-small: 1.6em;
183
+
184
+ // Line height aliases
185
+ --line-height-sm: var(--line-height-small);
186
+ --line-height-md: var(--line-height-base);
187
+ --line-height-lg: var(--line-height-large);
188
+ --line-height-xl: var(--line-height-extra-large);
189
+ --line-height-xxl: var(--line-height-display-2);
190
+ --line-height-xxxl: var(--line-height-display-1);
191
+
192
+ --letter-spacing-base: normal;
193
+ --letter-spacing-display-1: normal;
194
+ --letter-spacing-display-2: normal;
195
+ --letter-spacing-h1: normal;
196
+ --letter-spacing-h2: normal;
197
+ --letter-spacing-h3: normal;
198
+ --letter-spacing-h4: normal;
199
+ --letter-spacing-eyebrow: 0.1em;
200
+ --letter-spacing-small: normal;
201
+
202
+ // Letter spacing aliases
203
+ --letter-spacing-sm: var(--letter-spacing-small);
204
+ --letter-spacing-md: var(--letter-spacing-base);
205
+ --letter-spacing-lg: var(--letter-spacing-large);
206
+ --letter-spacing-xl: var(--letter-spacing-extra-large);
207
+ --letter-spacing-xxl: var(--letter-spacing-display-2);
208
+ --letter-spacing-xxxl: var(--letter-spacing-display-1);
209
+
210
+ --text-underline-offset: 0.3em;
211
+
212
+ // =====
213
+
214
+ // Borner thicknesses
215
+
216
+ --hairline: 1px;
217
+ --thin: 2px;
218
+ --medium: 4px;
219
+ --thick: 8px;
220
+
221
+ // Focus Outline
222
+ --focus-color: var(--blue-40);
223
+ --focus-outline: var(--medium) solid var(--focus-color);
224
+
225
+ // =====
226
+
227
+ // Border radius
228
+
229
+ --rounded-corners: var(--spacing-component-2);
230
+
231
+ // =====
232
+
233
+ // Shadows
234
+
235
+ --shadow-color: rgba(0,0,0,0.1);
236
+
237
+ --shadow-small:
238
+ 0.2px 0.7px 0.8px var(--shadow-color),
239
+ 0.9px 3px 3.5px -2.5px var(--shadow-color),
240
+ -2px -2px 2px -2px var(--shadow-color);
241
+ --shadow-medium:
242
+ 0.2px 0.7px 0.8px var(--shadow-color),
243
+ 1.1px 3.8px 4.5px -1.2px var(--shadow-color),
244
+ 4.3px 14.8px 17.3px -2.5px var(--shadow-color),
245
+ -2px -2px 2px -2px var(--shadow-color);
246
+ --shadow-large:
247
+ 0.2px 0.7px 0.8px var(--shadow-color),
248
+ 2.9px 10px 11.7px -0.8px var(--shadow-color),
249
+ 8.6px 30px 35.1px -1.7px var(--shadow-color),
250
+ 22.4px 77.8px 91.1px -2.5px var(--shadow-color);
251
+ }
@@ -0,0 +1,66 @@
1
+ import { Meta, Typeset } from '@storybook/blocks';
2
+
3
+ <Meta title="Typography" />
4
+
5
+ export const typography = {
6
+ type: {
7
+ serif: '"Source Serif 4"',
8
+ "sans-serif": '"Source Sans 3"',
9
+ },
10
+ weight: {
11
+ regular: '400',
12
+ bold: '700',
13
+ },
14
+ size: {
15
+ base: 20,
16
+ "display-1": 61,
17
+ "display-2": 49,
18
+ h1: 39,
19
+ h2: 31,
20
+ h3: 25,
21
+ h4: 20,
22
+ small: 16,
23
+ },
24
+ };
25
+
26
+ export const SampleText = 'We’ve been working for more than a decade with governments and communities across the country to break down barriers and find real solutions.';
27
+
28
+ # Typography
29
+
30
+ We use two font families on the Code for America website: **{typography.type.serif}** and **{typography.type["sans-serif"]}**. Our base font size is `20px` and our typography uses a _major third_ type scale.
31
+
32
+ ## Headings
33
+
34
+ Headings are set in **{typography.type.serif}**.
35
+
36
+ We have large _display_ sizes for headlines (`display-1` and `display-2`), and four standard heading levels (`h1` to `h4`).
37
+
38
+ <Typeset
39
+ fontSizes={[
40
+ Number(typography.size["display-1"]),
41
+ Number(typography.size["display-2"]),
42
+ Number(typography.size.h1),
43
+ Number(typography.size.h2),
44
+ Number(typography.size.h3),
45
+ Number(typography.size.h4),
46
+ ]}
47
+ fontWeight={typography.weight.bold}
48
+ sampleText={SampleText}
49
+ fontFamily={typography.type.serif}
50
+ />
51
+
52
+ ## Body text
53
+
54
+ Body text is set in **{typography.type["sans-serif"]}**. We have a size variations for variation in emphasis: `extra-large`, `large`, and `small`.
55
+
56
+ <Typeset
57
+ fontSizes={[
58
+ Number(typography.size.h2),
59
+ Number(typography.size.h3),
60
+ Number(typography.size.base),
61
+ Number(typography.size.small),
62
+ ]}
63
+ fontWeight={typography.weight.regular}
64
+ sampleText={SampleText}
65
+ fontFamily={typography.type["sans-serif"]}
66
+ />