@nationalarchives/frontend 0.1.8-prerelease → 0.1.10-prerelease

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 (94) hide show
  1. package/README.md +2 -2
  2. package/nationalarchives/_features.scss +1 -0
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -1
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/all.mjs +53 -6
  8. package/nationalarchives/assets/images/footer/facebook.svg +11 -0
  9. package/nationalarchives/assets/images/footer/flickr.svg +11 -0
  10. package/nationalarchives/assets/images/footer/instagram.svg +17 -0
  11. package/nationalarchives/assets/images/footer/rss.svg +13 -0
  12. package/nationalarchives/assets/images/footer/twitter.svg +14 -0
  13. package/nationalarchives/assets/images/footer/youtube.svg +12 -0
  14. package/nationalarchives/assets/images/tna-square-logo.svg +24 -45
  15. package/nationalarchives/components/_all.scss +4 -0
  16. package/nationalarchives/components/breadcrumbs/_index.scss +4 -3
  17. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +2 -3
  18. package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
  19. package/nationalarchives/components/breadcrumbs/macro-options.json +2 -2
  20. package/nationalarchives/components/breadcrumbs/template.njk +9 -9
  21. package/nationalarchives/components/button/_index.scss +25 -5
  22. package/nationalarchives/components/button/button.stories.js +2 -3
  23. package/nationalarchives/components/button/fixtures.json +5 -5
  24. package/nationalarchives/components/button/template.njk +3 -3
  25. package/nationalarchives/components/card/_index.scss +7 -3
  26. package/nationalarchives/components/card/card.stories.js +2 -3
  27. package/nationalarchives/components/card/fixtures.json +11 -11
  28. package/nationalarchives/components/card/template.njk +44 -44
  29. package/nationalarchives/components/filters/_index.scss +49 -0
  30. package/nationalarchives/components/filters/filters.stories.js +75 -0
  31. package/nationalarchives/components/filters/fixtures.json +4 -0
  32. package/nationalarchives/components/filters/macro-options.json +52 -0
  33. package/nationalarchives/components/filters/macro.njk +3 -0
  34. package/nationalarchives/components/filters/template.njk +8 -0
  35. package/nationalarchives/components/footer/_index.scss +49 -4
  36. package/nationalarchives/components/footer/fixtures.json +1 -1
  37. package/nationalarchives/components/footer/footer.stories.js +23 -26
  38. package/nationalarchives/components/footer/macro-options.json +12 -6
  39. package/nationalarchives/components/footer/template.njk +61 -51
  40. package/nationalarchives/components/grid/_index.scss +3 -78
  41. package/nationalarchives/components/grid/fixtures.json +12 -12
  42. package/nationalarchives/components/grid/grid.stories.js +3 -4
  43. package/nationalarchives/components/grid/template.njk +35 -35
  44. package/nationalarchives/components/header/_index.scss +452 -0
  45. package/nationalarchives/components/header/fixtures.json +4 -0
  46. package/nationalarchives/components/header/header.js +2 -0
  47. package/nationalarchives/components/header/header.js.map +1 -0
  48. package/nationalarchives/components/header/header.mjs +108 -0
  49. package/nationalarchives/components/header/header.stories.js +68 -0
  50. package/nationalarchives/components/header/macro-options.json +104 -0
  51. package/nationalarchives/components/header/macro.njk +3 -0
  52. package/nationalarchives/components/header/template.njk +66 -0
  53. package/nationalarchives/components/hero/_index.scss +4 -1
  54. package/nationalarchives/components/hero/hero.stories.js +17 -15
  55. package/nationalarchives/components/hero/macro-options.json +3 -3
  56. package/nationalarchives/components/hero/template.njk +27 -27
  57. package/nationalarchives/components/phase-banner/_index.scss +43 -0
  58. package/nationalarchives/components/phase-banner/fixtures.json +14 -0
  59. package/nationalarchives/components/phase-banner/macro-options.json +26 -0
  60. package/nationalarchives/components/phase-banner/macro.njk +3 -0
  61. package/nationalarchives/components/phase-banner/phase-banner.stories.js +38 -0
  62. package/nationalarchives/components/phase-banner/template.njk +16 -0
  63. package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
  64. package/nationalarchives/components/sensitive-image/macro-options.json +2 -2
  65. package/nationalarchives/components/sensitive-image/sensitive-image.js +1 -1
  66. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -1
  67. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +21 -22
  68. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +2 -3
  69. package/nationalarchives/components/sensitive-image/template.njk +7 -7
  70. package/nationalarchives/lib/uuid.mjs +9 -0
  71. package/nationalarchives/stories/development/contributing.mdx +38 -0
  72. package/nationalarchives/stories/development/dependencies.mdx +2 -0
  73. package/nationalarchives/stories/development/publishing.mdx +9 -0
  74. package/nationalarchives/stories/development/technologies.mdx +65 -0
  75. package/nationalarchives/stories/utilities/lists.stories.js +2 -2
  76. package/nationalarchives/stories/utilities/typography.mdx +15 -0
  77. package/nationalarchives/templates/homepage.njk +46 -46
  78. package/nationalarchives/templates/layouts/_generic.njk +49 -52
  79. package/nationalarchives/templates/layouts/_prototype-kit.njk +5 -0
  80. package/nationalarchives/templates/search-results.njk +31 -31
  81. package/nationalarchives/templates/topics.njk +33 -33
  82. package/nationalarchives/tools/_all.scss +1 -0
  83. package/nationalarchives/tools/_assets.scss +5 -0
  84. package/nationalarchives/tools/_grid.scss +52 -27
  85. package/nationalarchives/tools/_media.scss +12 -11
  86. package/nationalarchives/utilities/_global.scss +103 -3
  87. package/nationalarchives/utilities/_typography.scss +112 -92
  88. package/nationalarchives/variables/_all.scss +1 -0
  89. package/nationalarchives/variables/_assets.scss +1 -0
  90. package/nationalarchives/variables/_colour.scss +95 -1
  91. package/nationalarchives/variables/_media.scss +39 -11
  92. package/package.json +18 -16
  93. package/nationalarchives/assets/images/tna-square-logo-inverted.svg +0 -47
  94. package/nationalarchives/stories/development/structure.mdx +0 -7
@@ -1,5 +1,4 @@
1
1
  import Header from "./template.njk";
2
- import "./_index.scss";
3
2
  import macroOptions from "./macro-options.json";
4
3
 
5
4
  const argTypes = {
@@ -14,7 +13,7 @@ const argTypes = {
14
13
 
15
14
  Object.keys(argTypes).forEach((argType) => {
16
15
  argTypes[argType].description = macroOptions.find(
17
- (option) => option.name === argType
16
+ (option) => option.name === argType,
18
17
  )?.description;
19
18
  });
20
19
 
@@ -47,7 +46,7 @@ const Template = ({
47
46
 
48
47
  export const Standard = Template.bind({});
49
48
  Standard.args = {
50
- classes: "tna-container--demo",
49
+ classes: "tna-grid--demo",
51
50
  columns: [
52
51
  {
53
52
  html: "<p>Full width</p>",
@@ -189,6 +188,6 @@ const responsiveColumn = {
189
188
  widthTiny: "full",
190
189
  };
191
190
  Responsive.args = {
192
- classes: "tna-container--demo",
191
+ classes: "tna-grid--demo",
193
192
  columns: Array(12).fill({ ...responsiveColumn }),
194
193
  };
@@ -1,47 +1,47 @@
1
1
  {%- set htmlElement = params.htmlElement if params.htmlElement else 'div' -%}
2
2
  {%- set containerClasses = [params.classes] if params.classes else [] -%}
3
3
  {%- if params.maxWidth -%}
4
- {%- set containerClasses = containerClasses.concat('tna-container--max') -%}
4
+ {%- set containerClasses = containerClasses.concat('tna-container--max') -%}
5
5
  {%- endif -%}
6
6
  {%- if params.noPadding -%}
7
- {%- set containerClasses = containerClasses.concat('tna-container--no-padding') -%}
7
+ {%- set containerClasses = containerClasses.concat('tna-container--no-padding') -%}
8
8
  {%- endif -%}
9
9
  {%- if params.noPaddingAll -%}
10
- {%- set containerClasses = containerClasses.concat('tna-container--no-padding-all') -%}
10
+ {%- set containerClasses = containerClasses.concat('tna-container--no-padding-all') -%}
11
11
  {%- endif -%}
12
12
  <{{ htmlElement }} class="tna-container {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
13
13
  {%- for item in params.columns -%}
14
- {%- set columnHtmlElement = item.htmlElement if item.htmlElement else 'div' -%}
15
- {%- set columnClasses = [item.classes] if item.classes else [] -%}
16
- {%- if item.width -%}
17
- {%- set columnClasses = columnClasses.concat('tna-column--full') if item.width == 'full' else ( columnClasses.concat('tna-column--width-' + item.width) ) -%}
18
- {%- endif -%}
19
- {%- if item.widthMedium -%}
20
- {%- set columnClasses = columnClasses.concat('tna-column--full-medium') if item.widthMedium == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthMedium + '-medium') ) -%}
21
- {%- endif -%}
22
- {%- if item.widthSmall -%}
23
- {%- set columnClasses = columnClasses.concat('tna-column--full-small') if item.widthSmall == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthSmall + '-small') ) -%}
24
- {%- endif -%}
25
- {%- if item.widthTiny -%}
26
- {%- set columnClasses = columnClasses.concat('tna-column--full-tiny') if item.widthTiny == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthTiny + '-tiny') ) -%}
27
- {%- endif -%}
28
- {%- if item.flex -%}
29
- {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flex) -%}
30
- {%- endif -%}
31
- {%- if item.flexMedium -%}
32
- {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexMedium + '-medium') -%}
33
- {%- endif -%}
34
- {%- if item.flexSmall -%}
35
- {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexSmall + '-small') -%}
36
- {%- endif -%}
37
- {%- if item.flexTiny -%}
38
- {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexTiny + '-tiny') -%}
39
- {%- endif -%}
40
- {%- if item.noPadding -%}
41
- {%- set columnClasses = columnClasses.concat('tna-column--noPadding') -%}
42
- {%- endif -%}
43
- <{{ columnHtmlElement }} class="tna-column {{ columnClasses | join(' ') }}" {%- for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>
44
- {{ item.html | safe }}
45
- </{{ columnHtmlElement }}>
14
+ {%- set columnHtmlElement = item.htmlElement if item.htmlElement else 'div' -%}
15
+ {%- set columnClasses = [item.classes] if item.classes else [] -%}
16
+ {%- if item.width -%}
17
+ {%- set columnClasses = columnClasses.concat('tna-column--full') if item.width == 'full' else ( columnClasses.concat('tna-column--width-' + item.width) ) -%}
18
+ {%- endif -%}
19
+ {%- if item.widthMedium -%}
20
+ {%- set columnClasses = columnClasses.concat('tna-column--full-medium') if item.widthMedium == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthMedium + '-medium') ) -%}
21
+ {%- endif -%}
22
+ {%- if item.widthSmall -%}
23
+ {%- set columnClasses = columnClasses.concat('tna-column--full-small') if item.widthSmall == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthSmall + '-small') ) -%}
24
+ {%- endif -%}
25
+ {%- if item.widthTiny -%}
26
+ {%- set columnClasses = columnClasses.concat('tna-column--full-tiny') if item.widthTiny == 'full' else ( columnClasses.concat('tna-column--width-' + item.widthTiny + '-tiny') ) -%}
27
+ {%- endif -%}
28
+ {%- if item.flex -%}
29
+ {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flex) -%}
30
+ {%- endif -%}
31
+ {%- if item.flexMedium -%}
32
+ {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexMedium + '-medium') -%}
33
+ {%- endif -%}
34
+ {%- if item.flexSmall -%}
35
+ {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexSmall + '-small') -%}
36
+ {%- endif -%}
37
+ {%- if item.flexTiny -%}
38
+ {%- set columnClasses = columnClasses.concat('tna-column--flex-' + item.flexTiny + '-tiny') -%}
39
+ {%- endif -%}
40
+ {%- if item.noPadding -%}
41
+ {%- set columnClasses = columnClasses.concat('tna-column--noPadding') -%}
42
+ {%- endif -%}
43
+ <{{ columnHtmlElement }} class="tna-column {{ columnClasses | join(' ') }}" {%- for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>
44
+ {{ item.html | safe }}
45
+ </{{ columnHtmlElement }}>
46
46
  {%- endfor -%}
47
47
  </{{ htmlElement }}>
@@ -0,0 +1,452 @@
1
+ @use "sass:math";
2
+ @use "../../variables/colour";
3
+ @use "../../variables/grid";
4
+ @use "../../variables/typography";
5
+ @use "../../tools/media";
6
+ @use "../../tools/typography" as tools;
7
+
8
+ .tna-header {
9
+ color: #fff;
10
+
11
+ background-color: colour.$tna-black;
12
+
13
+ &__exit {
14
+ padding-top: 0.5rem;
15
+ padding-bottom: 0.5rem;
16
+
17
+ text-align: right;
18
+
19
+ background-color: colour.$dark;
20
+ }
21
+
22
+ &__exit-link {
23
+ color: #fff;
24
+ text-decoration: none;
25
+
26
+ &:hover {
27
+ text-decoration: underline;
28
+
29
+ // .tna-header__exit-link-icon {
30
+ // border-color: colour.$tna-yellow;
31
+
32
+ // &::before {
33
+ // border-top-color: colour.$tna-yellow;
34
+ // border-right-color: colour.$tna-yellow;
35
+ // }
36
+
37
+ // &::after {
38
+ // background-color: colour.$tna-yellow;
39
+ // }
40
+ // }
41
+ }
42
+ }
43
+
44
+ &__exit-link-icon {
45
+ width: 0.825rem;
46
+ height: 0.825rem;
47
+ margin-right: 0.125rem;
48
+ margin-left: 0.5rem;
49
+
50
+ display: inline-block;
51
+
52
+ position: relative;
53
+
54
+ vertical-align: middle;
55
+
56
+ border: 0.125rem #fff solid;
57
+
58
+ &::before {
59
+ position: absolute;
60
+ top: -0.25rem;
61
+ right: -0.25rem;
62
+ z-index: 2;
63
+
64
+ border: 0.25rem transparent solid;
65
+ border-top-color: #fff;
66
+ border-right-color: #fff;
67
+
68
+ content: "";
69
+ }
70
+
71
+ &::after {
72
+ width: 0.25rem;
73
+ height: 0.825rem;
74
+
75
+ position: absolute;
76
+ top: -0.125rem;
77
+ right: -0.125rem;
78
+ z-index: 1;
79
+
80
+ background-color: #fff;
81
+
82
+ outline: 0.2rem colour.$dark solid;
83
+
84
+ transform: rotate(45deg) translateX(50%);
85
+ transform-origin: 100% 0;
86
+
87
+ content: "";
88
+ }
89
+ }
90
+
91
+ &__contents {
92
+ &.tna-container {
93
+ justify-content: space-between;
94
+ }
95
+ }
96
+
97
+ &__logo {
98
+ padding-top: 1.25rem;
99
+ padding-bottom: 1.25rem;
100
+ }
101
+
102
+ &__logo-link {
103
+ display: -ms-flexbox;
104
+ display: flex;
105
+ align-items: flex-end;
106
+
107
+ color: inherit;
108
+ text-decoration: none;
109
+
110
+ &--href {
111
+ &:hover {
112
+ outline: 0.375rem #fff solid;
113
+ }
114
+ }
115
+ }
116
+
117
+ .tna-logo {
118
+ width: 6.25rem;
119
+ height: 6.25rem;
120
+
121
+ display: inline-block;
122
+ }
123
+
124
+ .tna-logo__foreground {
125
+ fill: #fff;
126
+ }
127
+
128
+ .tna-logo__background {
129
+ }
130
+
131
+ &__logo-strapline {
132
+ margin: 0 0.75rem;
133
+
134
+ display: inline-block;
135
+
136
+ line-height: 2.125;
137
+ text-transform: uppercase;
138
+ }
139
+
140
+ &__navigation-toggle {
141
+ align-self: center;
142
+ }
143
+
144
+ &__hamburger {
145
+ width: 2rem;
146
+ height: 0.25rem;
147
+
148
+ display: block;
149
+
150
+ background-color: #fff;
151
+
152
+ transition: height 1ms 200ms;
153
+
154
+ &::before,
155
+ &::after {
156
+ height: 0.25rem;
157
+
158
+ display: block;
159
+
160
+ position: absolute;
161
+ right: 0;
162
+ left: 0;
163
+
164
+ background-color: inherit;
165
+
166
+ transition:
167
+ top 200ms 200ms,
168
+ bottom 200ms 200ms,
169
+ transform 200ms;
170
+
171
+ content: "";
172
+ }
173
+
174
+ &::before {
175
+ top: 0;
176
+ }
177
+
178
+ &::after {
179
+ bottom: 0;
180
+ }
181
+ }
182
+
183
+ &__navigation-toggle-button {
184
+ height: 2rem;
185
+ padding: 0;
186
+
187
+ display: block;
188
+
189
+ position: relative;
190
+
191
+ appearance: none;
192
+
193
+ font-size: 0;
194
+
195
+ background: none;
196
+
197
+ border: 0 transparent solid;
198
+ border-width: 0.25rem 0;
199
+
200
+ cursor: pointer;
201
+
202
+ &--opened {
203
+ .tna-header__hamburger {
204
+ height: 0;
205
+
206
+ &::before,
207
+ &::after {
208
+ transition:
209
+ top 200ms,
210
+ bottom 200ms,
211
+ transform 200ms 200ms;
212
+ }
213
+
214
+ &::before {
215
+ top: 0.625rem;
216
+
217
+ transform: rotate(-135deg);
218
+ }
219
+
220
+ &::after {
221
+ bottom: 0.625rem;
222
+
223
+ transform: rotate(135deg);
224
+ }
225
+ }
226
+ }
227
+ }
228
+
229
+ &--yellow,
230
+ &--pink,
231
+ &--orange,
232
+ &--green,
233
+ &--blue {
234
+ color: colour.$tna-black;
235
+
236
+ .tna-header__logo-link {
237
+ &:hover {
238
+ outline-color: #000;
239
+ }
240
+ }
241
+
242
+ .tna-logo__foreground {
243
+ fill: #000;
244
+ }
245
+
246
+ .tna-header__hamburger {
247
+ background-color: colour.$tna-black;
248
+ }
249
+ }
250
+
251
+ &--yellow {
252
+ background-color: colour.$tna-yellow;
253
+ }
254
+
255
+ &--pink {
256
+ background-color: colour.$tna-pink;
257
+ }
258
+
259
+ &--orange {
260
+ background-color: colour.$tna-orange;
261
+ }
262
+
263
+ &--green {
264
+ background-color: colour.$tna-green;
265
+ }
266
+
267
+ &--blue {
268
+ background-color: colour.$tna-blue;
269
+ }
270
+
271
+ &__navigation {
272
+ display: -ms-flexbox;
273
+ display: flex;
274
+ justify-content: flex-end;
275
+ align-items: flex-end;
276
+ }
277
+
278
+ &__navigation-items {
279
+ margin: 0;
280
+ padding: 0;
281
+
282
+ list-style: none;
283
+
284
+ white-space: nowrap;
285
+ }
286
+
287
+ &__navigation-item {
288
+ margin-left: 0.75rem;
289
+
290
+ display: inline-block;
291
+ }
292
+
293
+ &__navigation-item-link {
294
+ padding: 0.5rem 1rem;
295
+
296
+ display: inline-block;
297
+
298
+ color: inherit;
299
+ font-family: typography.$font-family-heading;
300
+ text-decoration: none;
301
+ line-height: 2;
302
+
303
+ transition:
304
+ color 200ms,
305
+ background-color 200ms;
306
+
307
+ &:hover,
308
+ &--selected {
309
+ // color: colour.$tna-black;
310
+ @include colour.colour-font("dark-font");
311
+
312
+ // background-color: #fff;
313
+ @include colour.colour-background("page-background");
314
+
315
+ transition:
316
+ color 50ms,
317
+ background-color 50ms;
318
+ }
319
+ }
320
+
321
+ @include media.on-larger-than-mobile {
322
+ .tna-header__navigation-toggle {
323
+ display: none;
324
+ }
325
+ }
326
+
327
+ @include media.on-mobile {
328
+ $compensated-container-padding: grid.$gutter-width-mobile + 0.75rem;
329
+
330
+ &__contents {
331
+ &.tna-container {
332
+ padding-right: 0;
333
+ padding-left: 0;
334
+ }
335
+ }
336
+
337
+ &__logo {
338
+ padding-top: 1rem;
339
+ padding-bottom: 1rem;
340
+
341
+ &.tna-column {
342
+ padding-right: $compensated-container-padding;
343
+ padding-left: $compensated-container-padding;
344
+ }
345
+ }
346
+
347
+ .tna-logo {
348
+ width: 4.5rem;
349
+ height: 4.5rem;
350
+ }
351
+
352
+ &__logo-strapline {
353
+ line-height: 1.55;
354
+ }
355
+
356
+ &__navigation-toggle {
357
+ &.tna-column {
358
+ padding-right: $compensated-container-padding;
359
+ padding-left: 0;
360
+ }
361
+ }
362
+
363
+ &__navigation {
364
+ // color: colour.$base-font-colour;
365
+ @include colour.colour-font("base-font");
366
+ @include tools.relative-font-size(20);
367
+
368
+ &.tna-column {
369
+ padding-right: 0;
370
+ padding-left: 0;
371
+ }
372
+
373
+ .tna-template--js-enabled & {
374
+ display: none;
375
+
376
+ &--open {
377
+ display: block;
378
+ }
379
+ }
380
+ }
381
+
382
+ &__navigation-items {
383
+ width: 100%;
384
+
385
+ // background-color: #fff;
386
+ @include colour.colour-background("page-background");
387
+ }
388
+
389
+ &__navigation-item {
390
+ margin: 0;
391
+
392
+ display: block;
393
+
394
+ // border-bottom: 1px colour.$keyline-colour solid;
395
+ border-bottom: 1px solid;
396
+ @include colour.colour-border("keyline");
397
+ }
398
+
399
+ &__navigation-item-link {
400
+ padding-right: $compensated-container-padding;
401
+ padding-left: $compensated-container-padding;
402
+
403
+ display: block;
404
+
405
+ position: relative;
406
+
407
+ line-height: 1.6;
408
+
409
+ &::after {
410
+ width: 0;
411
+
412
+ position: absolute;
413
+ top: 0;
414
+ bottom: 0;
415
+ left: 0;
416
+
417
+ // background-color: colour.$tna-black;
418
+ @include colour.colour-background("dark-font");
419
+
420
+ transition: width 200ms;
421
+
422
+ content: "";
423
+ }
424
+
425
+ &:hover {
426
+ &::after {
427
+ width: 0.25rem;
428
+
429
+ transition: width 50ms;
430
+ }
431
+ }
432
+
433
+ &--selected {
434
+ &::after,
435
+ &:hover::after {
436
+ width: 0.5rem;
437
+ }
438
+ }
439
+ }
440
+ }
441
+
442
+ @include media.on-tiny {
443
+ .tna-logo {
444
+ width: 3.5rem;
445
+ height: 3.5rem;
446
+ }
447
+
448
+ &__logo-strapline {
449
+ line-height: 1.25;
450
+ }
451
+ }
452
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": "header",
3
+ "fixtures": []
4
+ }
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():(t.TNAFrontend=t.TNAFrontend||{},t.TNAFrontend["components/header/header"]=e())}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Header:()=>o});function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o.key),"symbol"===n(a)?a:String(a)),o)}var a}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$toggleButtonWrapper=e&&e.querySelector(".tna-header__navigation-toggle"),this.$navigation=e&&e.querySelector(".tna-header__navigation"),this.$links=e&&this.$navigation&&this.$navigation.querySelectorAll("[tabindex='0']"),this.menuOpened=!1,this.mql=window.matchMedia("(max-width: 768px)")}var e,n;return e=t,(n=[{key:"init",value:function(){var t=this;if(this.$module&&this.$toggleButtonWrapper&&this.$navigation){var e="menu-content-".concat(([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})));this.$navigation.setAttribute("id",e),this.$toggleButton=document.createElement("button"),this.$toggleButton.innerText="Menu",this.$toggleButton.setAttribute("aria-controls",e),this.$toggleButton.setAttribute("aria-haspopup","true"),this.$toggleButton.classList.add("tna-header__navigation-toggle-button"),this.$hamburger=document.createElement("div"),this.$hamburger.classList.add("tna-header__hamburger"),this.$toggleButton.appendChild(this.$hamburger),this.$toggleButtonWrapper.appendChild(this.$toggleButton),this.syncState(),this.$toggleButton.addEventListener("click",(function(){return t.handleToggleNavigation()})),"addEventListener"in this.mql?this.mql.addEventListener("change",(function(){return t.syncState()})):this.mql.addListener((function(){return t.syncState()}))}}},{key:"handleToggleNavigation",value:function(){this.menuOpened=!this.menuOpened,this.syncState()}},{key:"syncState",value:function(){if(this.mql.matches)if(this.menuOpened){this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu"),this.$toggleButton.classList.add("tna-header__navigation-toggle-button--opened");for(var t=0;t<this.$links.length;t++)this.$links[t].setAttribute("tabindex","0")}else{this.$navigation.classList.remove("tna-header__navigation--open"),this.$navigation.hidden=!0,this.$navigation.setAttribute("aria-hidden","true"),this.$toggleButton.setAttribute("aria-expanded","false"),this.$toggleButton.setAttribute("title","Open menu"),this.$toggleButton.classList.remove("tna-header__navigation-toggle-button--opened");for(var e=0;e<this.$links.length;e++)this.$links[e].setAttribute("tabindex","-1")}else{this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu");for(var n=0;n<this.$links.length;n++)this.$links[n].setAttribute("tabindex","0")}}}])&&i(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();return e})()));
2
+ //# sourceMappingURL=header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components/header/header.js","mappings":"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","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/header/header.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/header/header\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Header {\n constructor($module) {\n this.$module = $module;\n this.$toggleButtonWrapper =\n $module && $module.querySelector(\".tna-header__navigation-toggle\");\n this.$navigation =\n $module && $module.querySelector(\".tna-header__navigation\");\n this.$links =\n $module &&\n this.$navigation &&\n this.$navigation.querySelectorAll(\"[tabindex='0']\");\n this.menuOpened = false;\n this.mql = window.matchMedia(\"(max-width: 768px)\");\n }\n\n init() {\n if (!this.$module || !this.$toggleButtonWrapper || !this.$navigation) {\n return;\n }\n\n // const uniqueLinkIds = []\n\n // for (let i = 0; i < this.$links.length; i++) {\n // const uniqueLinkId = uuidv4()\n // this.$links[i].setAttribute(\"id\", uniqueLinkId);\n // uniqueLinkIds.push(uniqueLinkId)\n // }\n\n const uniqueId = `menu-content-${uuidv4()}`;\n this.$navigation.setAttribute(\"id\", uniqueId);\n // this.$navigation.setAttribute(\"aria-owns\", uniqueLinkIds.join(\",\"));\n\n this.$toggleButton = document.createElement(\"button\");\n this.$toggleButton.innerText = \"Menu\";\n this.$toggleButton.setAttribute(\"aria-controls\", uniqueId);\n this.$toggleButton.setAttribute(\"aria-haspopup\", \"true\");\n this.$toggleButton.classList.add(\"tna-header__navigation-toggle-button\");\n\n this.$hamburger = document.createElement(\"div\");\n this.$hamburger.classList.add(\"tna-header__hamburger\");\n\n this.$toggleButton.appendChild(this.$hamburger);\n this.$toggleButtonWrapper.appendChild(this.$toggleButton);\n\n this.syncState();\n\n this.$toggleButton.addEventListener(\"click\", () =>\n this.handleToggleNavigation(),\n );\n\n if (\"addEventListener\" in this.mql) {\n this.mql.addEventListener(\"change\", () => this.syncState());\n // this.mql.addEventListener(\"change\", this.syncState.bind(this));\n } else {\n this.mql.addListener(() => this.syncState());\n // this.mql.addListener(this.syncState.bind(this));\n }\n }\n\n handleToggleNavigation() {\n this.menuOpened = !this.menuOpened;\n this.syncState();\n }\n\n syncState() {\n if (this.mql.matches) {\n if (this.menuOpened) {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n this.$toggleButton.classList.add(\n \"tna-header__navigation-toggle-button--opened\",\n );\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n } else {\n this.$navigation.classList.remove(\"tna-header__navigation--open\");\n this.$navigation.hidden = true;\n this.$navigation.setAttribute(\"aria-hidden\", \"true\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"false\");\n this.$toggleButton.setAttribute(\"title\", \"Open menu\");\n this.$toggleButton.classList.remove(\n \"tna-header__navigation-toggle-button--opened\",\n );\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"-1\");\n }\n }\n } else {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n }\n }\n}\n","const uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Header","$module","_classCallCheck","this","$toggleButtonWrapper","querySelector","$navigation","$links","querySelectorAll","menuOpened","mql","window","matchMedia","_this","uniqueId","concat","replace","c","crypto","getRandomValues","Uint8Array","toString","setAttribute","$toggleButton","document","createElement","innerText","classList","add","$hamburger","appendChild","syncState","addEventListener","handleToggleNavigation","addListener","matches","hidden","i","length","remove"],"sourceRoot":""}