@nationalarchives/frontend 0.1.65 → 0.2.1

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 (237) hide show
  1. package/config/.eslintrc.js +1 -1
  2. package/config/.htmlvalidate.json +12 -5
  3. package/config/stylelint.config.js +1 -0
  4. package/nationalarchives/all.css +1 -1
  5. package/nationalarchives/all.css.map +1 -1
  6. package/nationalarchives/all.js +1 -1
  7. package/nationalarchives/all.js.map +1 -1
  8. package/nationalarchives/all.mjs +0 -18
  9. package/nationalarchives/analytics.js +1 -1
  10. package/nationalarchives/analytics.js.map +1 -1
  11. package/nationalarchives/analytics.mjs +1 -1
  12. package/nationalarchives/components/_forms.scss +9 -0
  13. package/nationalarchives/components/_index.scss +2 -35
  14. package/nationalarchives/components/_presentation.scss +23 -0
  15. package/nationalarchives/components/accordion/accordion.css +1 -1
  16. package/nationalarchives/components/accordion/accordion.css.map +1 -1
  17. package/nationalarchives/components/accordion/accordion.js +1 -1
  18. package/nationalarchives/components/accordion/accordion.js.map +1 -1
  19. package/nationalarchives/components/accordion/accordion.mjs +1 -4
  20. package/nationalarchives/components/accordion/accordion.scss +4 -0
  21. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  22. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
  23. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
  24. package/nationalarchives/components/button/button.css +1 -1
  25. package/nationalarchives/components/button/button.css.map +1 -1
  26. package/nationalarchives/components/button/button.scss +9 -9
  27. package/nationalarchives/components/card/card.css +1 -1
  28. package/nationalarchives/components/card/card.css.map +1 -1
  29. package/nationalarchives/components/card/card.scss +15 -0
  30. package/nationalarchives/components/card/fixtures.json +74 -26
  31. package/nationalarchives/components/card/macro-options.json +7 -7
  32. package/nationalarchives/components/card/template.njk +7 -4
  33. package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
  34. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  35. package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
  36. package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
  37. package/nationalarchives/components/checkboxes/macro-options.json +6 -0
  38. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  39. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  40. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  41. package/nationalarchives/components/date-input/date-input.css +1 -1
  42. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  43. package/nationalarchives/components/date-input/date-input.scss +2 -2
  44. package/nationalarchives/components/date-input/fixtures.json +5 -5
  45. package/nationalarchives/components/date-input/template.njk +1 -1
  46. package/nationalarchives/components/date-search/date-search.css +1 -1
  47. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  48. package/nationalarchives/components/date-search/date-search.scss +2 -2
  49. package/nationalarchives/components/details/details.css.map +1 -1
  50. package/nationalarchives/components/details/template.njk +3 -1
  51. package/nationalarchives/components/error-summary/error-summary.css +1 -1
  52. package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
  53. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  54. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  55. package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
  56. package/nationalarchives/components/error-summary/error-summary.scss +3 -4
  57. package/nationalarchives/components/files-list/_index.scss +1 -0
  58. package/nationalarchives/components/files-list/files-list.css +1 -0
  59. package/nationalarchives/components/files-list/files-list.css.map +1 -0
  60. package/nationalarchives/components/{files/files.scss → files-list/files-list.scss} +2 -7
  61. package/nationalarchives/components/files-list/fixtures.json +74 -0
  62. package/nationalarchives/components/{files → files-list}/macro-options.json +6 -0
  63. package/nationalarchives/components/files-list/macro.njk +3 -0
  64. package/nationalarchives/components/files-list/template.njk +33 -0
  65. package/nationalarchives/components/footer/footer.css.map +1 -1
  66. package/nationalarchives/components/footer/footer.js +1 -1
  67. package/nationalarchives/components/footer/footer.js.map +1 -1
  68. package/nationalarchives/components/gallery/fixtures.json +1 -1
  69. package/nationalarchives/components/gallery/gallery.css +1 -1
  70. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  71. package/nationalarchives/components/gallery/gallery.js +1 -1
  72. package/nationalarchives/components/gallery/gallery.js.map +1 -1
  73. package/nationalarchives/components/gallery/gallery.scss +36 -29
  74. package/nationalarchives/components/gallery/template.njk +10 -8
  75. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  76. package/nationalarchives/components/global-header/global-header.js +1 -1
  77. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  78. package/nationalarchives/components/header/header.css.map +1 -1
  79. package/nationalarchives/components/header/header.js +1 -1
  80. package/nationalarchives/components/header/header.js.map +1 -1
  81. package/nationalarchives/components/hero/hero.css +1 -1
  82. package/nationalarchives/components/hero/hero.css.map +1 -1
  83. package/nationalarchives/components/hero/hero.scss +0 -24
  84. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  85. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  86. package/nationalarchives/components/index-grid/index-grid.scss +1 -1
  87. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  88. package/nationalarchives/components/picture/picture.css.map +1 -1
  89. package/nationalarchives/components/picture/picture.js +1 -1
  90. package/nationalarchives/components/picture/picture.js.map +1 -1
  91. package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
  92. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
  93. package/nationalarchives/components/radios/radios.css +1 -1
  94. package/nationalarchives/components/radios/radios.css.map +1 -1
  95. package/nationalarchives/components/radios/radios.scss +1 -1
  96. package/nationalarchives/components/records-list/_index.scss +1 -0
  97. package/nationalarchives/components/records-list/fixtures.json +42 -0
  98. package/nationalarchives/components/records-list/macro.njk +3 -0
  99. package/nationalarchives/components/records-list/records-list.css +1 -0
  100. package/nationalarchives/components/records-list/records-list.css.map +1 -0
  101. package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +1 -1
  102. package/nationalarchives/components/records-list/template.njk +21 -0
  103. package/nationalarchives/components/search-field/search-field.css +1 -1
  104. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  105. package/nationalarchives/components/search-field/search-field.scss +1 -1
  106. package/nationalarchives/components/select/select.css +1 -1
  107. package/nationalarchives/components/select/select.css.map +1 -1
  108. package/nationalarchives/components/select/select.scss +2 -2
  109. package/nationalarchives/components/sidebar/fixtures.json +12 -2
  110. package/nationalarchives/components/sidebar/sidebar.css +1 -1
  111. package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
  112. package/nationalarchives/components/sidebar/template.njk +9 -0
  113. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  114. package/nationalarchives/components/skip-link/skip-link.js +1 -1
  115. package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
  116. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  117. package/nationalarchives/components/tabs/tabs.js +1 -1
  118. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  119. package/nationalarchives/components/text-input/text-input.css +1 -1
  120. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  121. package/nationalarchives/components/text-input/text-input.scss +2 -2
  122. package/nationalarchives/components/textarea/textarea.css +1 -1
  123. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  124. package/nationalarchives/components/textarea/textarea.scss +2 -2
  125. package/nationalarchives/components/warning/warning.css +1 -1
  126. package/nationalarchives/components/warning/warning.css.map +1 -1
  127. package/nationalarchives/components/warning/warning.scss +1 -0
  128. package/nationalarchives/global-header-package.css +1 -1
  129. package/nationalarchives/global-header-package.css.map +1 -1
  130. package/nationalarchives/global-header-package.scss +1 -1
  131. package/nationalarchives/print.css +1 -1
  132. package/nationalarchives/print.css.map +1 -1
  133. package/nationalarchives/prototype-kit.css +1 -1
  134. package/nationalarchives/prototype-kit.css.map +1 -1
  135. package/nationalarchives/templates/fixtures.json +1 -1
  136. package/nationalarchives/tools/_colour.scss +28 -53
  137. package/nationalarchives/utilities/_columns.scss +1 -1
  138. package/nationalarchives/utilities/_index.scss +1 -0
  139. package/nationalarchives/utilities/_reset.scss +2 -8
  140. package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
  141. package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
  142. package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +6 -1
  143. package/nationalarchives/utilities/grid/macro.njk +3 -0
  144. package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +27 -9
  145. package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +2 -2
  146. package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +20 -8
  147. package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +30 -10
  148. package/nationalarchives/variables/_colour.scss +12 -5
  149. package/package.json +3 -3
  150. package/nationalarchives/components/accordion/accordion.stories.js +0 -432
  151. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
  152. package/nationalarchives/components/button/button-group.stories.js +0 -114
  153. package/nationalarchives/components/button/button.stories.js +0 -207
  154. package/nationalarchives/components/card/card.stories.js +0 -402
  155. package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
  156. package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
  157. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
  158. package/nationalarchives/components/date-input/date-input.stories.js +0 -119
  159. package/nationalarchives/components/date-search/date-search.stories.js +0 -124
  160. package/nationalarchives/components/details/details.stories.js +0 -33
  161. package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
  162. package/nationalarchives/components/featured-records/_index.scss +0 -1
  163. package/nationalarchives/components/featured-records/featured-records.css +0 -1
  164. package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
  165. package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
  166. package/nationalarchives/components/featured-records/fixtures.json +0 -42
  167. package/nationalarchives/components/featured-records/macro.njk +0 -3
  168. package/nationalarchives/components/featured-records/template.njk +0 -21
  169. package/nationalarchives/components/files/_index.scss +0 -1
  170. package/nationalarchives/components/files/files.css +0 -1
  171. package/nationalarchives/components/files/files.css.map +0 -1
  172. package/nationalarchives/components/files/files.stories.js +0 -59
  173. package/nationalarchives/components/files/fixtures.json +0 -71
  174. package/nationalarchives/components/files/macro.njk +0 -3
  175. package/nationalarchives/components/files/template.njk +0 -33
  176. package/nationalarchives/components/footer/footer.stories.js +0 -241
  177. package/nationalarchives/components/gallery/gallery.stories.js +0 -87
  178. package/nationalarchives/components/global-header/global-header.stories.js +0 -364
  179. package/nationalarchives/components/grid/_index.scss +0 -1
  180. package/nationalarchives/components/grid/grid.css +0 -1
  181. package/nationalarchives/components/grid/grid.css.map +0 -1
  182. package/nationalarchives/components/grid/grid.stories.js +0 -279
  183. package/nationalarchives/components/grid/macro.njk +0 -3
  184. package/nationalarchives/components/header/header.stories.js +0 -239
  185. package/nationalarchives/components/hero/hero.stories.js +0 -326
  186. package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
  187. package/nationalarchives/components/pagination/pagination.stories.js +0 -532
  188. package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
  189. package/nationalarchives/components/picture/picture.stories.js +0 -75
  190. package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
  191. package/nationalarchives/components/radios/radios.stories.js +0 -244
  192. package/nationalarchives/components/search-field/search-field.stories.js +0 -88
  193. package/nationalarchives/components/search-filters/_index.scss +0 -1
  194. package/nationalarchives/components/search-filters/fixtures.json +0 -16
  195. package/nationalarchives/components/search-filters/macro-options.json +0 -39
  196. package/nationalarchives/components/search-filters/macro.njk +0 -3
  197. package/nationalarchives/components/search-filters/search-filters.css +0 -1
  198. package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
  199. package/nationalarchives/components/search-filters/search-filters.js +0 -2
  200. package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
  201. package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
  202. package/nationalarchives/components/search-filters/search-filters.scss +0 -198
  203. package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
  204. package/nationalarchives/components/search-filters/template.njk +0 -108
  205. package/nationalarchives/components/select/select.stories.js +0 -197
  206. package/nationalarchives/components/sensitive-image/_index.scss +0 -1
  207. package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
  208. package/nationalarchives/components/sensitive-image/macro-options.json +0 -58
  209. package/nationalarchives/components/sensitive-image/macro.njk +0 -3
  210. package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
  211. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
  212. package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
  213. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
  214. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
  215. package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
  216. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
  217. package/nationalarchives/components/sensitive-image/template.njk +0 -11
  218. package/nationalarchives/components/sidebar/sidebar.stories.js +0 -227
  219. package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
  220. package/nationalarchives/components/tabs/tabs.stories.js +0 -300
  221. package/nationalarchives/components/text-input/text-input.stories.js +0 -188
  222. package/nationalarchives/components/textarea/textarea.stories.js +0 -130
  223. package/nationalarchives/components/warning/warning.stories.js +0 -39
  224. package/nationalarchives/stories/intro.mdx +0 -13
  225. package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
  226. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1513
  227. package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
  228. package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
  229. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
  230. package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
  231. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
  232. package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
  233. package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
  234. /package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
  235. /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
  236. /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
  237. /package/nationalarchives/{components → utilities}/grid/template.njk +0 -0
@@ -1,239 +0,0 @@
1
- import Header from "./template.njk";
2
- import macroOptions from "./macro-options.json";
3
- import { within, userEvent, expect } from "@storybook/test";
4
- import { customViewports } from "../../../../.storybook/viewports";
5
-
6
- const argTypes = {
7
- logo: { control: "object" },
8
- topNavigation: { control: "object" },
9
- navigation: { control: "object" },
10
- accent: {
11
- control: "boolean",
12
- },
13
- exit: { control: "object" },
14
- classes: { control: "text" },
15
- attributes: { control: "object" },
16
- };
17
-
18
- Object.keys(argTypes).forEach((argType) => {
19
- argTypes[argType].description = macroOptions.find(
20
- (option) => option.name === argType,
21
- )?.description;
22
- });
23
-
24
- export default {
25
- title: "Components/Header",
26
- argTypes,
27
- parameters: {
28
- chromatic: { delay: 1000 },
29
- },
30
- };
31
-
32
- const Template = ({
33
- logo,
34
- topNavigation,
35
- navigation,
36
- accent,
37
- exit,
38
- classes,
39
- attributes,
40
- }) =>
41
- Header({
42
- params: {
43
- logo,
44
- topNavigation,
45
- navigation,
46
- accent,
47
- exit,
48
- classes,
49
- attributes,
50
- },
51
- });
52
-
53
- export const Standard = Template.bind({});
54
- Standard.args = {
55
- logo: {
56
- strapline: "Design System",
57
- href: "#/",
58
- },
59
- topNavigation: [
60
- {
61
- text: "Top item 1",
62
- href: "#/top-1",
63
- },
64
- {
65
- text: "Top item 2",
66
- href: "#/top-2",
67
- icon: "heart",
68
- },
69
- ],
70
- navigation: [
71
- {
72
- text: "Alpha",
73
- href: "#/alpha",
74
- selected: true,
75
- },
76
- {
77
- text: "Beta",
78
- href: "#/beta",
79
- },
80
- {
81
- text: "Gamma",
82
- href: "#/gamma",
83
- },
84
- ],
85
- exit: {
86
- text: "Go to the current National Archives website",
87
- href: "#",
88
- target: "_blank",
89
- },
90
- classes: "tna-header--demo",
91
- };
92
- Standard.play = async ({ canvasElement }) => {
93
- await new Promise((r) => setTimeout(r, 100));
94
-
95
- const $navigationItems = canvasElement.querySelector(
96
- `.tna-header__navigation-items`,
97
- );
98
- const $navigationToggle = canvasElement.querySelector(
99
- `.tna-header__navigation-toggle-button`,
100
- );
101
-
102
- await expect($navigationItems).toBeVisible();
103
- await expect($navigationToggle).not.toBeVisible();
104
- };
105
-
106
- export const Accent = Template.bind({});
107
- Accent.args = {
108
- logo: {
109
- strapline: "Design System",
110
- href: "#/",
111
- },
112
- topNavigation: [
113
- {
114
- text: "Top item 1",
115
- href: "#/top-1",
116
- },
117
- {
118
- text: "Top item 2",
119
- href: "#/top-2",
120
- icon: "heart",
121
- },
122
- ],
123
- navigation: [
124
- {
125
- text: "Alpha",
126
- href: "#/alpha",
127
- selected: true,
128
- },
129
- {
130
- text: "Beta",
131
- href: "#/beta",
132
- },
133
- {
134
- text: "Gamma",
135
- href: "#/gamma",
136
- },
137
- ],
138
- exit: {
139
- text: "Go to the current National Archives website",
140
- href: "#",
141
- target: "_blank",
142
- },
143
- accent: true,
144
- classes: "tna-header--demo",
145
- };
146
-
147
- export const Mobile = Template.bind({});
148
- Mobile.parameters = {
149
- viewport: {
150
- defaultViewport: "small",
151
- },
152
- chromatic: {
153
- viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
154
- },
155
- };
156
- Mobile.args = {
157
- logo: {
158
- strapline: "Design System",
159
- href: "#/",
160
- },
161
- topNavigation: [
162
- {
163
- text: "Top item 1",
164
- href: "#/top-1",
165
- },
166
- {
167
- text: "Top item 2",
168
- href: "#/top-2",
169
- icon: "heart",
170
- },
171
- ],
172
- navigation: [
173
- {
174
- text: "Alpha",
175
- href: "#/alpha",
176
- selected: true,
177
- },
178
- {
179
- text: "Beta",
180
- href: "#/beta",
181
- },
182
- {
183
- text: "Gamma",
184
- href: "#/gamma",
185
- },
186
- ],
187
- exit: {
188
- text: "Go to the current National Archives website",
189
- href: "#",
190
- target: "_blank",
191
- },
192
- classes: "tna-header--demo",
193
- };
194
- Mobile.play = async ({ args, canvasElement, step }) => {
195
- await new Promise((r) => setTimeout(r, 100));
196
-
197
- const canvas = within(canvasElement);
198
-
199
- const $navigationItems = canvasElement.querySelector(
200
- `.tna-header__navigation-items`,
201
- );
202
- const [$linkA, $linkB, $linkC] = args.navigation.map((navigationItem) =>
203
- canvas.getByText(navigationItem.text),
204
- );
205
- const $navigationToggle = canvasElement.querySelector(
206
- `.tna-header__navigation-toggle-button`,
207
- );
208
-
209
- await step("Initial load", async () => {
210
- await expect($navigationItems).not.toBeVisible();
211
- await expect($navigationToggle).toBeVisible();
212
- await expect($navigationToggle).toHaveAttribute("aria-expanded", "false");
213
- await expect($linkA).not.toBeVisible();
214
- await expect($linkB).not.toBeVisible();
215
- await expect($linkC).not.toBeVisible();
216
- });
217
-
218
- await step("Open the menu", async () => {
219
- await userEvent.click($navigationToggle);
220
- await expect($navigationItems).toBeVisible();
221
- await expect($navigationToggle).toBeVisible();
222
- await expect($navigationToggle).toHaveAttribute("aria-expanded", "true");
223
- await expect($linkA).toBeVisible();
224
- await expect($linkB).toBeVisible();
225
- await expect($linkC).toBeVisible();
226
- });
227
-
228
- await step("Close the menu", async () => {
229
- await userEvent.click($navigationToggle);
230
- await expect($navigationItems).not.toBeVisible();
231
- await expect($navigationToggle).toBeVisible();
232
- await expect($navigationToggle).toHaveAttribute("aria-expanded", "false");
233
- await expect($linkA).not.toBeVisible();
234
- await expect($linkB).not.toBeVisible();
235
- await expect($linkC).not.toBeVisible();
236
- });
237
-
238
- $navigationToggle.blur();
239
- };
@@ -1,326 +0,0 @@
1
- import Hero from "./template.njk";
2
- import macroOptions from "./macro-options.json";
3
- import { within, userEvent, expect } from "@storybook/test";
4
- import { customViewports } from "../../../../.storybook/viewports";
5
-
6
- const argTypes = {
7
- supertitle: { control: "text" },
8
- title: { control: "text" },
9
- headingLevel: { control: { type: "number", min: 1, max: 6 } },
10
- headingSize: { control: "inline-radio", options: ["s", "m", "l", "xl"] },
11
- body: { control: "text" },
12
- text: { control: "text" },
13
- imageSrc: { control: { type: "file", accept: ".jpg" } },
14
- imageAlt: { control: "text" },
15
- imageWidth: { control: { type: "number", min: 1 } },
16
- imageHeight: { control: { type: "number", min: 1 } },
17
- imageType: { control: "text" },
18
- imageSources: { control: "object" },
19
- imageCaption: { control: "text" },
20
- actions: { control: "object" },
21
- style: {
22
- control: "inline-radio",
23
- options: ["none", "contrast", "tint", "accent"],
24
- },
25
- layout: {
26
- control: "inline-radio",
27
- options: ["plain", "shift", "split"],
28
- },
29
- narrow: { control: "boolean" },
30
- classes: { control: "text" },
31
- attributes: { control: "object" },
32
- };
33
-
34
- Object.keys(argTypes).forEach((argType) => {
35
- argTypes[argType].description = macroOptions.find(
36
- (option) => option.name === argType,
37
- )?.description;
38
- });
39
-
40
- export default {
41
- title: "Components/Hero",
42
- argTypes,
43
- };
44
-
45
- const Template = ({
46
- supertitle,
47
- title,
48
- headingLevel,
49
- headingSize,
50
- body,
51
- text,
52
- imageSrc,
53
- imageAlt,
54
- imageWidth,
55
- imageHeight,
56
- imageType,
57
- imageSources,
58
- imageCaption,
59
- actions,
60
- style,
61
- layout,
62
- narrow,
63
- classes,
64
- attributes,
65
- }) =>
66
- Hero({
67
- params: {
68
- supertitle,
69
- title,
70
- headingLevel,
71
- headingSize,
72
- body,
73
- text,
74
- imageSrc,
75
- imageAlt,
76
- imageWidth,
77
- imageHeight,
78
- imageType,
79
- imageSources,
80
- imageCaption,
81
- actions,
82
- style,
83
- layout,
84
- narrow,
85
- classes,
86
- attributes,
87
- },
88
- });
89
-
90
- export const Standard = Template.bind({});
91
- Standard.args = {
92
- title: "Title",
93
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
94
- imageSrc:
95
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
96
- imageAlt: "The National Archives office",
97
- imageWidth: 499,
98
- imageHeight: 333,
99
- imageCaption: "An interesting photo by a famous photographer ©2023",
100
- };
101
-
102
- Standard.play = async ({ args, canvasElement, step }) => {
103
- await new Promise((r) => setTimeout(r, 100));
104
-
105
- const canvas = within(canvasElement);
106
- const image = canvas.getByAltText(args.imageAlt);
107
- const content = canvasElement.querySelector(".tna-hero__content");
108
- const summary = canvasElement.querySelector(".tna-hero__details-summary");
109
- const information = canvas.getByText(args.imageCaption);
110
-
111
- await step("Initial load", async () => {
112
- await expect(image).toBeVisible();
113
- await expect(content).toBeVisible();
114
- await expect(summary).toBeVisible();
115
- await expect(information).not.toBeVisible();
116
- });
117
-
118
- await step("Open information", async () => {
119
- await userEvent.click(summary);
120
- await expect(information).toBeVisible();
121
- });
122
-
123
- await step("Close information", async () => {
124
- await userEvent.click(summary);
125
- await expect(information).not.toBeVisible();
126
- });
127
- };
128
-
129
- export const LargeContent = Template.bind({});
130
- LargeContent.parameters = {
131
- chromatic: { disableSnapshot: true },
132
- };
133
- LargeContent.args = {
134
- supertitle: "Focus on",
135
- title: "‘Not acceptable’: Gay Switchboard’s attempts to become a charity",
136
- body: `<p class="tna-large-paragraph">Switchboard LGBT+ Helpline is one of the oldest telephone help services for lesbian, gay, bisexual, transgender and queer people in the UK. Despite high demand for its support, prejudice and laws meant Switchboard’s journey to register as a charity was not easy.</p>`,
137
- imageSrc:
138
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
139
- imageAlt: "The National Archives office",
140
- imageWidth: 499,
141
- imageHeight: 333,
142
- imageCaption: "An interesting photo by a famous photographer ©2023",
143
- };
144
-
145
- export const Accent = Template.bind({});
146
- Accent.parameters = {
147
- chromatic: { disableSnapshot: true },
148
- };
149
- Accent.args = {
150
- supertitle: "Supertitle",
151
- title: "Title",
152
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
153
- imageSrc:
154
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
155
- imageAlt: "The National Archives office",
156
- imageWidth: 499,
157
- imageHeight: 333,
158
- imageCaption: "An interesting photo by a famous photographer ©2023",
159
- style: "accent",
160
- };
161
-
162
- export const Contrast = Template.bind({});
163
- Contrast.parameters = {
164
- chromatic: { disableSnapshot: true },
165
- };
166
- Contrast.args = {
167
- supertitle: "Supertitle",
168
- title: "Title",
169
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
170
- imageSrc:
171
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
172
- imageAlt: "The National Archives office",
173
- imageWidth: 499,
174
- imageHeight: 333,
175
- imageCaption: "An interesting photo by a famous photographer ©2023",
176
- style: "contrast",
177
- };
178
-
179
- export const Tint = Template.bind({});
180
- Tint.parameters = {
181
- chromatic: { disableSnapshot: true },
182
- };
183
- Tint.args = {
184
- supertitle: "Supertitle",
185
- title: "Title",
186
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
187
- imageSrc:
188
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
189
- imageAlt: "The National Archives office",
190
- imageWidth: 499,
191
- imageHeight: 333,
192
- imageCaption: "An interesting photo by a famous photographer ©2023",
193
- style: "tint",
194
- };
195
-
196
- export const Shifted = Template.bind({});
197
- Shifted.args = {
198
- title: "Title",
199
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
200
- imageSrc:
201
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
202
- imageAlt: "The National Archives office",
203
- imageWidth: 499,
204
- imageHeight: 333,
205
- imageCaption: "An interesting photo by a famous photographer ©2023",
206
- style: "accent",
207
- layout: "shift",
208
- };
209
-
210
- export const Split = Template.bind({});
211
- Split.args = {
212
- title: "Title",
213
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
214
- imageSrc:
215
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
216
- imageAlt: "The National Archives office",
217
- imageWidth: 499,
218
- imageHeight: 333,
219
- imageCaption: "An interesting photo by a famous photographer ©2023",
220
- style: "accent",
221
- layout: "split",
222
- };
223
-
224
- export const Narrow = Template.bind({});
225
- Narrow.args = {
226
- title: "Title",
227
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
228
- imageSrc:
229
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
230
- imageAlt: "The National Archives office",
231
- imageWidth: 499,
232
- imageHeight: 333,
233
- imageCaption: "An interesting photo by a famous photographer ©2023",
234
- style: "accent",
235
- // layout: "split",
236
- narrow: true,
237
- };
238
-
239
- export const Actions = Template.bind({});
240
- Actions.args = {
241
- supertitle: "Supertitle",
242
- title: "Title",
243
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
244
- imageSrc:
245
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
246
- imageAlt: "The National Archives office",
247
- imageWidth: 499,
248
- imageHeight: 333,
249
- imageCaption: "An interesting photo by a famous photographer ©2023",
250
- actions: [
251
- {
252
- text: "Action 1",
253
- href: "#",
254
- },
255
- {
256
- text: "Action 2",
257
- href: "#",
258
- icon: "globe",
259
- },
260
- {
261
- text: "Action 3",
262
- href: "#",
263
- title: "Go and do the action",
264
- icon: "chevron-right",
265
- rightAlignIcon: true,
266
- },
267
- ],
268
- style: "accent",
269
- };
270
-
271
- export const CaptionWithNoHeading = Template.bind({});
272
- CaptionWithNoHeading.parameters = {
273
- chromatic: { disableSnapshot: true },
274
- };
275
- CaptionWithNoHeading.args = {
276
- imageSrc:
277
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
278
- imageAlt: "The National Archives office",
279
- imageWidth: 499,
280
- imageHeight: 333,
281
- imageCaption: "An interesting photo by a famous photographer ©2023",
282
- };
283
-
284
- export const Sources = Template.bind({});
285
- Sources.parameters = {
286
- chromatic: { disableSnapshot: true },
287
- };
288
- Sources.args = {
289
- title: "Title",
290
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
291
- imageSrc:
292
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
293
- imageAlt: "The National Archives office",
294
- imageWidth: 499,
295
- imageHeight: 333,
296
- imageSources: [
297
- {
298
- src: "https://www.gstatic.com/webp/gallery/2.webp",
299
- type: "image/webp",
300
- media: "(max-width: 48em)",
301
- width: 550,
302
- height: 404,
303
- },
304
- ],
305
- };
306
-
307
- export const Mobile = Template.bind({});
308
- Mobile.parameters = {
309
- viewport: {
310
- defaultViewport: "small",
311
- },
312
- chromatic: {
313
- viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
314
- },
315
- };
316
- Mobile.args = {
317
- supertitle: "Supertitle",
318
- title: "Title",
319
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
320
- imageSrc:
321
- "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
322
- imageAlt: "The National Archives office",
323
- imageWidth: 499,
324
- imageHeight: 333,
325
- imageCaption: "An interesting photo by a famous photographer ©2023",
326
- };
@@ -1,128 +0,0 @@
1
- import IndexGrid from "./template.njk";
2
- import macroOptions from "./macro-options.json";
3
-
4
- const argTypes = {
5
- supertitle: { control: "text" },
6
- title: { control: "text" },
7
- headingLevel: { control: { type: "number", min: 1, max: 6 } },
8
- headingSize: { control: "inline-radio", options: ["s", "m", "l", "xl"] },
9
- href: { control: "text" },
10
- hrefClasses: { control: "text" },
11
- hrefAttributes: { control: "object" },
12
- body: { control: "text" },
13
- text: { control: "text" },
14
- items: { control: "object" },
15
- lazyImages: { control: "boolean" },
16
- columns: { control: "number" },
17
- columnsMedium: { control: "number" },
18
- columnsSmall: { control: "number" },
19
- columnsTiny: { control: "number" },
20
- classes: { control: "text" },
21
- attributes: { control: "object" },
22
- };
23
-
24
- Object.keys(argTypes).forEach((argType) => {
25
- argTypes[argType].description = macroOptions.find(
26
- (option) => option.name === argType,
27
- )?.description;
28
- });
29
-
30
- export default {
31
- title: "Components/Index grid",
32
- argTypes,
33
- };
34
-
35
- const Template = ({
36
- supertitle,
37
- title,
38
- headingLevel,
39
- headingSize,
40
- href,
41
- hrefClasses,
42
- hrefAttributes,
43
- body,
44
- text,
45
- items,
46
- lazyImages,
47
- columns,
48
- columnsMedium,
49
- columnsSmall,
50
- columnsTiny,
51
- classes,
52
- attributes,
53
- }) =>
54
- IndexGrid({
55
- params: {
56
- supertitle,
57
- title,
58
- headingLevel,
59
- headingSize,
60
- href,
61
- hrefClasses,
62
- hrefAttributes,
63
- body,
64
- text,
65
- items,
66
- lazyImages,
67
- columns,
68
- columnsMedium,
69
- columnsSmall,
70
- columnsTiny,
71
- classes,
72
- attributes,
73
- },
74
- });
75
-
76
- const exampleItem = {
77
- href: "#",
78
- src: "https://picsum.photos/id/237/800/600",
79
- alt: "Photo of a puppy",
80
- width: 800,
81
- height: 600,
82
- title: "Cat",
83
- };
84
-
85
- export const Standard = Template.bind({});
86
- Standard.args = {
87
- title: "My dogs",
88
- headingLevel: 2,
89
- items: Array(12)
90
- .fill({ ...exampleItem })
91
- .map((item, index) => {
92
- const pseudoRandom = ((index * 29) % 8) + 1;
93
- return {
94
- ...item,
95
- href: `#/category-${index}`,
96
- label: "Time period",
97
- title: `Category #${index + 101}`,
98
- subtitle: `${pseudoRandom} photos`,
99
- };
100
- }),
101
- columns: 4,
102
- columnsMedium: 3,
103
- columnsSmall: 2,
104
- columnsTiny: 1,
105
- classes: "tna-index-grid--demo",
106
- };
107
-
108
- export const Basic = Template.bind({});
109
- Basic.parameters = {
110
- chromatic: { disableSnapshot: true },
111
- };
112
- Basic.args = {
113
- title: "My dogs",
114
- items: Array(6)
115
- .fill({ ...exampleItem })
116
- .map((item, index) => {
117
- return {
118
- ...item,
119
- href: `#/category-${index}`,
120
- title: `Category #${index + 101}`,
121
- };
122
- }),
123
- columns: 3,
124
- columnsMedium: 3,
125
- columnsSmall: 2,
126
- columnsTiny: 1,
127
- classes: "tna-index-grid--demo",
128
- };