@nationalarchives/frontend 0.1.24-prerelease → 0.1.25-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.
- package/README.md +22 -0
- package/govuk-prototype-kit.config.json +4 -12
- package/nationalarchives/all.css +2 -2
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +8 -8
- package/nationalarchives/components/button/template.njk +2 -2
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +6 -2
- package/nationalarchives/components/card/card.stories.js +6 -78
- package/nationalarchives/components/card/fixtures.json +17 -17
- package/nationalarchives/components/card/macro-options.json +41 -17
- package/nationalarchives/components/card/template.njk +46 -45
- package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.mjs +17 -16
- package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +92 -42
- package/nationalarchives/components/cookie-banner/fixtures.json +35 -8
- package/nationalarchives/components/cookie-banner/macro-options.json +7 -1
- package/nationalarchives/components/cookie-banner/template.njk +1 -1
- package/nationalarchives/components/featured-records/featured-records.css +1 -1
- package/nationalarchives/components/featured-records/featured-records.css.map +1 -1
- package/nationalarchives/components/filters/filters.css +1 -1
- package/nationalarchives/components/filters/filters.css.map +1 -1
- package/nationalarchives/components/filters/filters.scss +6 -6
- package/nationalarchives/components/filters/template.njk +1 -1
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.stories.js +1 -1
- package/nationalarchives/components/footer/template.njk +3 -3
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.stories.js +2 -2
- package/nationalarchives/components/grid/grid.css +1 -1
- package/nationalarchives/components/grid/grid.css.map +1 -1
- package/nationalarchives/components/grid/grid.scss +12 -0
- package/nationalarchives/components/grid/grid.stories.js +12 -0
- package/nationalarchives/components/header/header.css +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.scss +13 -19
- package/nationalarchives/components/header/template.njk +2 -2
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +2 -2
- package/nationalarchives/components/hero/hero.stories.js +6 -0
- package/nationalarchives/components/index-grid/index-grid.css +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/index-grid.stories.js +3 -1
- package/nationalarchives/components/message/message.css +1 -1
- package/nationalarchives/components/message/message.css.map +1 -1
- package/nationalarchives/components/pagination/macro-options.json +6 -0
- package/nationalarchives/components/pagination/pagination.css +1 -1
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.scss +4 -0
- package/nationalarchives/components/pagination/pagination.stories.js +63 -2
- package/nationalarchives/components/pagination/template.njk +9 -2
- package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/picture/picture.css +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css.map +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -0
- package/nationalarchives/components/skip-link/skip-link.css +1 -1
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.stories.js +4 -1
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.stories.js +6 -3
- package/nationalarchives/lib/cookies.mjs +165 -62
- package/nationalarchives/prototype-kit.css +2 -2
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/prototype-kit.scss +3 -3
- package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +153 -65
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +1 -0
- package/nationalarchives/stories/utilities/tables/tables.mdx +8 -0
- package/nationalarchives/stories/utilities/tables/tables.stories.js +45 -0
- package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +59 -19
- package/nationalarchives/templates/layouts/_prototype-kit.njk +2 -0
- package/nationalarchives/tests/cookies.test.js +427 -0
- package/nationalarchives/tests/uuid.test.js +17 -0
- package/nationalarchives/tools/_colour.scss +2 -0
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_lists.scss +5 -0
- package/nationalarchives/utilities/_tables.scss +86 -0
- package/nationalarchives/utilities/_typography.scss +5 -20
- package/nationalarchives/variables/_colour.scss +1 -0
- package/package.json +6 -6
@@ -7,6 +7,8 @@ const argTypes = {
|
|
7
7
|
headingLevel: { control: { type: "number", min: 1, max: 6 } },
|
8
8
|
headingSize: { control: "inline-radio", options: ["s", "m", "l"] },
|
9
9
|
href: { control: "text" },
|
10
|
+
hrefClasses: { control: "text" },
|
11
|
+
hrefAttributes: { control: "object" },
|
10
12
|
imageSrc: { control: { type: "file", accept: ".jpg" } },
|
11
13
|
imageAlt: { control: "text" },
|
12
14
|
imageWidth: { control: { type: "number", min: 1 } },
|
@@ -45,6 +47,8 @@ const Template = ({
|
|
45
47
|
headingLevel,
|
46
48
|
headingSize,
|
47
49
|
href,
|
50
|
+
hrefClasses,
|
51
|
+
hrefAttributes,
|
48
52
|
imageSrc,
|
49
53
|
imageAlt,
|
50
54
|
imageWidth,
|
@@ -70,6 +74,8 @@ const Template = ({
|
|
70
74
|
headingLevel,
|
71
75
|
headingSize,
|
72
76
|
href,
|
77
|
+
hrefClasses,
|
78
|
+
hrefAttributes,
|
73
79
|
imageSrc,
|
74
80
|
imageAlt,
|
75
81
|
imageWidth,
|
@@ -302,81 +308,3 @@ Sources.args = {
|
|
302
308
|
htmlElement: "article",
|
303
309
|
classes: "tna-card--demo",
|
304
310
|
};
|
305
|
-
|
306
|
-
export const WithoutImage = Template.bind({});
|
307
|
-
WithoutImage.args = {
|
308
|
-
supertitle: "Card supertitle",
|
309
|
-
title: "Card title",
|
310
|
-
headingLevel: 3,
|
311
|
-
headingSize: "s",
|
312
|
-
body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis.</p>",
|
313
|
-
htmlElement: "article",
|
314
|
-
classes: "tna-card--demo",
|
315
|
-
};
|
316
|
-
|
317
|
-
const GridTemplate = ({
|
318
|
-
title,
|
319
|
-
supertitle,
|
320
|
-
headingLevel,
|
321
|
-
headingSize,
|
322
|
-
href,
|
323
|
-
imageSrc,
|
324
|
-
imageAlt,
|
325
|
-
imageWidth,
|
326
|
-
imageHeight,
|
327
|
-
imageSources,
|
328
|
-
label,
|
329
|
-
body,
|
330
|
-
text,
|
331
|
-
actions,
|
332
|
-
horizontal,
|
333
|
-
htmlElement,
|
334
|
-
classes,
|
335
|
-
attributes,
|
336
|
-
}) =>
|
337
|
-
`<div class="tna-container">
|
338
|
-
${Array(12)
|
339
|
-
.fill(
|
340
|
-
`<div class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny tna-!--margin-bottom-m">
|
341
|
-
${Card({
|
342
|
-
params: {
|
343
|
-
title,
|
344
|
-
supertitle,
|
345
|
-
headingLevel,
|
346
|
-
headingSize,
|
347
|
-
href,
|
348
|
-
imageSrc,
|
349
|
-
imageAlt,
|
350
|
-
imageWidth,
|
351
|
-
imageHeight,
|
352
|
-
imageSources,
|
353
|
-
label,
|
354
|
-
body,
|
355
|
-
text,
|
356
|
-
actions,
|
357
|
-
horizontal,
|
358
|
-
htmlElement,
|
359
|
-
classes,
|
360
|
-
attributes,
|
361
|
-
},
|
362
|
-
})}
|
363
|
-
</div>`,
|
364
|
-
)
|
365
|
-
.join("")}
|
366
|
-
</div>`;
|
367
|
-
|
368
|
-
export const Grid = GridTemplate.bind({});
|
369
|
-
Grid.args = {
|
370
|
-
title: "Card title",
|
371
|
-
headingLevel: 3,
|
372
|
-
headingSize: "s",
|
373
|
-
href: "#",
|
374
|
-
imageSrc:
|
375
|
-
"https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
376
|
-
imageAlt: "The National Archives office",
|
377
|
-
imageWidth: 499,
|
378
|
-
imageHeight: 333,
|
379
|
-
body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis.</p>",
|
380
|
-
htmlElement: "article",
|
381
|
-
classes: "tna-card--demo",
|
382
|
-
};
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"headingLevel": 3,
|
9
9
|
"body": "<p>Card body</p>"
|
10
10
|
},
|
11
|
-
"html": "<div class=\"tna-card
|
11
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
12
12
|
"hidden": false
|
13
13
|
},
|
14
14
|
{
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"headingLevel": 3,
|
20
20
|
"body": "<p>Card body</p>"
|
21
21
|
},
|
22
|
-
"html": "<div class=\"tna-card
|
22
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><hgroup class=\"tna-hgroup-s tna-card__heading\"><h3 class=\"tna-hgroup__title\"><span class=\"tna-hgroup__supertitle\">Card supertitle</span>Card title</h3></hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
23
23
|
"hidden": false
|
24
24
|
},
|
25
25
|
{
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"headingSize": "xl",
|
31
31
|
"body": "<p>Card body</p>"
|
32
32
|
},
|
33
|
-
"html": "<div class=\"tna-card
|
33
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-xl tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
34
34
|
"hidden": false
|
35
35
|
},
|
36
36
|
{
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"headingLevel": 1,
|
41
41
|
"body": "<p>Card body</p>"
|
42
42
|
},
|
43
|
-
"html": "<div class=\"tna-card
|
43
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h1 class=\" tna-heading-s tna-card__heading\">Card title</h1><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
44
44
|
"hidden": false
|
45
45
|
},
|
46
46
|
{
|
@@ -51,7 +51,7 @@
|
|
51
51
|
"href": "#",
|
52
52
|
"body": "<p>Card body</p>"
|
53
53
|
},
|
54
|
-
"html": "<div class=\"tna-card
|
54
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\"><a href=\"#\" class=\"tna-card__heading-link\">Card title</a></h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
55
55
|
"hidden": false
|
56
56
|
},
|
57
57
|
{
|
@@ -75,7 +75,7 @@
|
|
75
75
|
],
|
76
76
|
"body": "<p>Card body</p>"
|
77
77
|
},
|
78
|
-
"html": "<div class=\"tna-card
|
78
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><ul class=\"tna-card__meta\"><li class=\"tna-card__meta-item\"><i class=\"fa-solid fa-fw fa-calendar\"></i>24th September 2023</li><li class=\"tna-card__meta-item\"><i class=\"fa-solid fa-fw fa-ticket\"></i>From £16</li><li class=\"tna-card__meta-item\"><i class=\"fa-solid fa-fw fa-location-dot\"></i>Online</li></ul><p>Card body</p></div></div></div>",
|
79
79
|
"hidden": false
|
80
80
|
},
|
81
81
|
{
|
@@ -85,7 +85,7 @@
|
|
85
85
|
"headingLevel": 3,
|
86
86
|
"text": "Card body"
|
87
87
|
},
|
88
|
-
"html": "<div class=\"tna-card
|
88
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
89
89
|
"hidden": false
|
90
90
|
},
|
91
91
|
{
|
@@ -99,7 +99,7 @@
|
|
99
99
|
"imageHeight": 360,
|
100
100
|
"body": "<p>Card body</p>"
|
101
101
|
},
|
102
|
-
"html": "<div class=\"tna-card
|
102
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__image-container\"><picture class=\"tna-card__image\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\"></picture></div><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
103
103
|
"hidden": false
|
104
104
|
},
|
105
105
|
{
|
@@ -119,7 +119,7 @@
|
|
119
119
|
],
|
120
120
|
"body": "<p>Card body</p>"
|
121
121
|
},
|
122
|
-
"html": "<div class=\"tna-card
|
122
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__image-container\"><picture class=\"tna-card__image\"><source srcset=\"https://www.gstatic.com/webp/gallery/2.webp\" type=\"image/webp\" width=\"640\" height=\"360\"><source srcset=\"https://loremflickr.com/640/360\" type=\"image/jpeg\" width=\"640\" height=\"360\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\"></picture></div><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
123
123
|
"hidden": false
|
124
124
|
},
|
125
125
|
{
|
@@ -134,7 +134,7 @@
|
|
134
134
|
"href": "#",
|
135
135
|
"body": "<p>Card body</p>"
|
136
136
|
},
|
137
|
-
"html": "<div class=\"tna-card
|
137
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\"><a href=\"#\" class=\"tna-card__heading-link\">Card title</a></h3><a href=\"#\" class=\"tna-card__image-container\" tabindex=\"-1\"><picture class=\"tna-card__image\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\"></picture></a><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
138
138
|
"hidden": false
|
139
139
|
},
|
140
140
|
{
|
@@ -151,7 +151,7 @@
|
|
151
151
|
}
|
152
152
|
]
|
153
153
|
},
|
154
|
-
"html": "<div class=\"tna-card
|
154
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div><div class=\"tna-card__actions\"><a href=\"#\" class=\"tna-card__action\" role=\"button\" title=\"Go and do the action\">Card action</a></div></div></div>",
|
155
155
|
"hidden": false
|
156
156
|
},
|
157
157
|
{
|
@@ -162,7 +162,7 @@
|
|
162
162
|
"label": "New",
|
163
163
|
"body": "<p>Card body</p>"
|
164
164
|
},
|
165
|
-
"html": "<div class=\"tna-card
|
165
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
166
166
|
"hidden": false
|
167
167
|
},
|
168
168
|
{
|
@@ -173,7 +173,7 @@
|
|
173
173
|
"body": "<p>Card body</p>",
|
174
174
|
"style": "boxed"
|
175
175
|
},
|
176
|
-
"html": "<div class=\"tna-card tna-card--contrast\"
|
176
|
+
"html": "<div class=\"tna-card tna-card--contrast\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
177
177
|
"hidden": false
|
178
178
|
},
|
179
179
|
{
|
@@ -184,7 +184,7 @@
|
|
184
184
|
"body": "<p>Card body</p>",
|
185
185
|
"style": "accent"
|
186
186
|
},
|
187
|
-
"html": "<div class=\"tna-card tna-card--accent\"
|
187
|
+
"html": "<div class=\"tna-card tna-card--accent\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
188
188
|
"hidden": false
|
189
189
|
},
|
190
190
|
{
|
@@ -195,7 +195,7 @@
|
|
195
195
|
"body": "<p>Card body</p>",
|
196
196
|
"style": "foobar"
|
197
197
|
},
|
198
|
-
"html": "<div class=\"tna-card
|
198
|
+
"html": "<div class=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
199
199
|
"hidden": false
|
200
200
|
},
|
201
201
|
{
|
@@ -206,7 +206,7 @@
|
|
206
206
|
"body": "<p>Card body</p>",
|
207
207
|
"classes": "card__test-class"
|
208
208
|
},
|
209
|
-
"html": "<div class=\"tna-card card__test-class\"
|
209
|
+
"html": "<div class=\"tna-card card__test-class\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
210
210
|
"hidden": false
|
211
211
|
},
|
212
212
|
{
|
@@ -219,7 +219,7 @@
|
|
219
219
|
"data-testattribute": "foobar"
|
220
220
|
}
|
221
221
|
},
|
222
|
-
"html": "<div class=\"tna-card
|
222
|
+
"html": "<div class=\"tna-card\" data-testattribute=\"foobar\"><div class=\"tna-card__inner\"><h3 class=\" tna-heading-s tna-card__heading\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
223
223
|
"hidden": false
|
224
224
|
}
|
225
225
|
]
|
@@ -28,13 +28,25 @@
|
|
28
28
|
"name": "href",
|
29
29
|
"type": "string",
|
30
30
|
"required": false,
|
31
|
-
"description": "A URL to use as a link in the card's heading and image
|
31
|
+
"description": "A URL to use as a link in the card's heading and image."
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"name": "hrefClasses",
|
35
|
+
"type": "string",
|
36
|
+
"required": false,
|
37
|
+
"description": "Classes to add to the elements of the card that use `href`."
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"name": "hrefAttributes",
|
41
|
+
"type": "object",
|
42
|
+
"required": false,
|
43
|
+
"description": "HTML attributes (for example data attributes) to add to the elements of the card that use `href`."
|
32
44
|
},
|
33
45
|
{
|
34
46
|
"name": "imageSrc",
|
35
47
|
"type": "string",
|
36
48
|
"required": false,
|
37
|
-
"description": "
|
49
|
+
"description": "The location of the card's image."
|
38
50
|
},
|
39
51
|
{
|
40
52
|
"name": "imageAlt",
|
@@ -58,43 +70,43 @@
|
|
58
70
|
"name": "imageType",
|
59
71
|
"type": "string",
|
60
72
|
"required": false,
|
61
|
-
"description": ""
|
73
|
+
"description": "The mime type of the image. Defaults to `image/jpeg`. Only required when using `imageSources`."
|
62
74
|
},
|
63
75
|
{
|
64
76
|
"name": "imageSources",
|
65
77
|
"type": "array",
|
66
|
-
"required":
|
67
|
-
"description": "Alternative sources of the image
|
78
|
+
"required": false,
|
79
|
+
"description": "Alternative sources of the image.",
|
68
80
|
"params": [
|
69
81
|
{
|
70
82
|
"name": "src",
|
71
83
|
"type": "string",
|
72
84
|
"required": true,
|
73
|
-
"description": ""
|
85
|
+
"description": "The location of the image."
|
74
86
|
},
|
75
87
|
{
|
76
88
|
"name": "type",
|
77
89
|
"type": "string",
|
78
90
|
"required": true,
|
79
|
-
"description": ""
|
91
|
+
"description": "The mime type of the image."
|
80
92
|
},
|
81
93
|
{
|
82
94
|
"name": "media",
|
83
95
|
"type": "string",
|
84
96
|
"required": false,
|
85
|
-
"description": ""
|
97
|
+
"description": "A media condition for the image."
|
86
98
|
},
|
87
99
|
{
|
88
100
|
"name": "width",
|
89
101
|
"type": "number",
|
90
102
|
"required": false,
|
91
|
-
"description": ""
|
103
|
+
"description": "The width of the image in pixels."
|
92
104
|
},
|
93
105
|
{
|
94
106
|
"name": "height",
|
95
107
|
"type": "number",
|
96
108
|
"required": false,
|
97
|
-
"description": ""
|
109
|
+
"description": "The height of the image in pixels."
|
98
110
|
}
|
99
111
|
]
|
100
112
|
},
|
@@ -120,14 +132,14 @@
|
|
120
132
|
"name": "icon",
|
121
133
|
"type": "string",
|
122
134
|
"required": false,
|
123
|
-
"description": "The name of a
|
135
|
+
"description": "The name of a Font Awesome icon, without the prefixed `fa-`."
|
124
136
|
}
|
125
137
|
]
|
126
138
|
},
|
127
139
|
{
|
128
140
|
"name": "body",
|
129
141
|
"type": "string",
|
130
|
-
"required":
|
142
|
+
"required": false,
|
131
143
|
"description": "The HTML for the main body of the card. Not displayed if `text` is set."
|
132
144
|
},
|
133
145
|
{
|
@@ -146,31 +158,43 @@
|
|
146
158
|
"name": "text",
|
147
159
|
"type": "string",
|
148
160
|
"required": true,
|
149
|
-
"description": ""
|
161
|
+
"description": "The text for the action."
|
150
162
|
},
|
151
163
|
{
|
152
164
|
"name": "href",
|
153
165
|
"type": "string",
|
154
166
|
"required": true,
|
155
|
-
"description": ""
|
167
|
+
"description": "The URL of the action."
|
156
168
|
},
|
157
169
|
{
|
158
170
|
"name": "title",
|
159
171
|
"type": "string",
|
160
172
|
"required": false,
|
161
|
-
"description": ""
|
173
|
+
"description": "An optional title for the action."
|
162
174
|
},
|
163
175
|
{
|
164
176
|
"name": "icon",
|
165
177
|
"type": "string",
|
166
178
|
"required": false,
|
167
|
-
"description": ""
|
179
|
+
"description": "The name of a Font Awesome icon, without the prefixed `fa-`."
|
168
180
|
},
|
169
181
|
{
|
170
182
|
"name": "brandIcon",
|
171
183
|
"type": "string",
|
172
184
|
"required": false,
|
173
|
-
"description": ""
|
185
|
+
"description": "The name of a Font Awesome brand icon, without the prefixed `fa-`."
|
186
|
+
},
|
187
|
+
{
|
188
|
+
"name": "classes",
|
189
|
+
"type": "string",
|
190
|
+
"required": false,
|
191
|
+
"description": "Classes to add to the card action."
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"name": "attributes",
|
195
|
+
"type": "object",
|
196
|
+
"required": false,
|
197
|
+
"description": "HTML attributes (for example data attributes) to add to the card action."
|
174
198
|
}
|
175
199
|
]
|
176
200
|
},
|
@@ -8,86 +8,87 @@
|
|
8
8
|
{%- elseif params.style == "accent" -%}
|
9
9
|
{%- set containerClasses = containerClasses.concat('tna-card--accent') -%}
|
10
10
|
{%- endif -%}
|
11
|
-
|
11
|
+
{%- set classes = containerClasses | join(' ') -%}
|
12
|
+
<{{ htmlElement }} class="tna-card{% if classes %} {{ classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
12
13
|
<div class="tna-card__inner">
|
13
|
-
{%- if params.supertitle
|
14
|
+
{%- if params.supertitle %}
|
14
15
|
<hgroup class="tna-hgroup-{{ params.headingSize or 's' }} tna-card__heading">
|
15
16
|
<h{{ params.headingLevel }} class="tna-hgroup__title">
|
16
17
|
<span class="tna-hgroup__supertitle{% if params.plainSupertitle %} tna-hgroup__supertitle--plain{% endif %}">{{ params.supertitle }}</span>
|
17
|
-
{%- if params.href
|
18
|
-
<a href="{{ params.href }}" class="tna-card__heading-link">{{ params.title }}</a>
|
19
|
-
{%- else
|
18
|
+
{%- if params.href %}
|
19
|
+
<a href="{{ params.href }}" class="tna-card__heading-link{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" {%- for attribute, value in params.hrefAttributes %} {{ attribute }}="{{ value }}"{% endfor %}>{{ params.title }}</a>
|
20
|
+
{%- else %}
|
20
21
|
{{ params.title }}
|
21
|
-
{%- endif
|
22
|
+
{%- endif %}
|
22
23
|
</h{{ params.headingLevel }}>
|
23
24
|
</hgroup>
|
24
|
-
{%- else
|
25
|
+
{%- else %}
|
25
26
|
<h{{ params.headingLevel }} class=" tna-heading-{{ params.headingSize or 's' }} tna-card__heading">
|
26
|
-
{%- if params.href
|
27
|
-
<a href="{{ params.href }}" class="tna-card__heading-link">{{ params.title }}</a>
|
28
|
-
{%- else
|
27
|
+
{%- if params.href %}
|
28
|
+
<a href="{{ params.href }}" class="tna-card__heading-link{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" {%- for attribute, value in params.hrefAttributes %} {{ attribute }}="{{ value }}"{% endfor %}>{{ params.title }}</a>
|
29
|
+
{%- else %}
|
29
30
|
{{ params.title }}
|
30
|
-
{%- endif
|
31
|
+
{%- endif %}
|
31
32
|
</h{{ params.headingLevel }}>
|
32
|
-
{%- endif
|
33
|
-
{%- if params.imageSrc
|
34
|
-
{%- if params.href
|
35
|
-
<a href="{{ params.href }}" class="tna-card__image-container" tabindex="-1">
|
36
|
-
{%- else
|
33
|
+
{%- endif %}
|
34
|
+
{%- if params.imageSrc %}
|
35
|
+
{%- if params.href %}
|
36
|
+
<a href="{{ params.href }}" class="tna-card__image-container{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" tabindex="-1" {%- for attribute, value in params.hrefAttributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
37
|
+
{%- else %}
|
37
38
|
<div class="tna-card__image-container">
|
38
|
-
{%- endif
|
39
|
+
{%- endif %}
|
39
40
|
<picture class="tna-card__image">
|
40
|
-
{%- if params.imageSources
|
41
|
+
{%- if params.imageSources %}
|
41
42
|
{%- for source in params.imageSources %}
|
42
43
|
<source srcset="{{ source.src }}" type="{{ source.type }}" width="{{ source.width if source.width else params.imageWidth }}" height="{{ source.height if source.height else params.imageHeight }}">
|
43
44
|
{%- endfor %}
|
44
45
|
<source srcset="{{ params.imageSrc }}" type="{{ params.imageType if params.imageType else 'image/jpeg' }}" width="{{ params.imageWidth }}" height="{{ params.imageHeight }}">
|
45
|
-
{
|
46
|
+
{% endif %}
|
46
47
|
<img src="{{ params.imageSrc }}" alt="{{ params.imageAlt }}" width="{{ params.imageWidth }}" height="{{ params.imageHeight }}">
|
47
48
|
</picture>
|
48
|
-
{%- if params.label
|
49
|
+
{%- if params.label %}
|
49
50
|
<div class="tna-chip tna-card__image-label">
|
50
51
|
{{ params.label }}
|
51
52
|
</div>
|
52
|
-
{%- endif
|
53
|
-
{%- if params.href
|
53
|
+
{%- endif %}
|
54
|
+
{%- if params.href %}
|
54
55
|
</a>
|
55
|
-
{%- else
|
56
|
+
{%- else %}
|
56
57
|
</div>
|
57
|
-
{%- endif
|
58
|
-
{%- endif
|
58
|
+
{%- endif %}
|
59
|
+
{%- endif %}
|
59
60
|
<div class="tna-card__body">
|
60
|
-
{%- if params.meta
|
61
|
+
{%- if params.meta %}
|
61
62
|
<ul class="tna-card__meta">
|
62
|
-
{%- for item in params.meta
|
63
|
+
{%- for item in params.meta %}
|
63
64
|
<li class="tna-card__meta-item">
|
64
|
-
{%- if item.icon
|
65
|
-
<i class="fa-solid fa-{{ item.icon }}"></i>
|
66
|
-
{%- endif
|
65
|
+
{%- if item.icon %}
|
66
|
+
<i class="fa-solid fa-fw fa-{{ item.icon }}"></i>
|
67
|
+
{%- endif %}
|
67
68
|
{{ item.text }}
|
68
69
|
</li>
|
69
|
-
{%- endfor
|
70
|
+
{%- endfor %}
|
70
71
|
</ul>
|
71
|
-
{%- endif
|
72
|
-
{%- if params.text
|
72
|
+
{%- endif %}
|
73
|
+
{%- if params.text %}
|
73
74
|
<p>{{ params.text }}</p>
|
74
|
-
{%- else
|
75
|
+
{%- else %}
|
75
76
|
{{ params.body | safe }}
|
76
|
-
{%- endif
|
77
|
+
{%- endif %}
|
77
78
|
</div>
|
78
|
-
{%- if params.actions
|
79
|
+
{%- if params.actions %}
|
79
80
|
<div class="tna-card__actions">
|
80
|
-
{%- for item in params.actions
|
81
|
-
<a href="{{ item.href }}" class="tna-card__action" role="button" {%- if item.title %}title="{{ item.title }}"{% endif %}>
|
82
|
-
{%- if item.brandIcon
|
83
|
-
<i class="fa-brands fa-{{ item.brandIcon }}"></i>
|
84
|
-
{%- elseif item.icon
|
85
|
-
<i class="fa-solid fa-{{ item.icon }}"></i>
|
86
|
-
{%- endif
|
81
|
+
{%- for item in params.actions %}
|
82
|
+
<a href="{{ item.href }}" class="tna-card__action{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" role="button" {%- if item.title %} title="{{ item.title }}"{% endif %} {%- for attribute, value in params.hrefAttributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
83
|
+
{%- if item.brandIcon %}
|
84
|
+
<i class="fa-brands fa-fw fa-{{ item.brandIcon }}"></i>
|
85
|
+
{%- elseif item.icon %}
|
86
|
+
<i class="fa-solid fa-fw fa-{{ item.icon }}"></i>
|
87
|
+
{%- endif %}
|
87
88
|
{{ item.text }}
|
88
89
|
</a>
|
89
|
-
{%- endfor
|
90
|
+
{%- endfor %}
|
90
91
|
</div>
|
91
|
-
{%- endif
|
92
|
+
{%- endif %}
|
92
93
|
</div>
|
93
94
|
</{{ htmlElement }}>
|