@nationalarchives/frontend 0.1.9-prerelease → 0.1.11-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 +3 -3
- package/govuk-prototype-kit.config.json +0 -3
- package/nationalarchives/_features.scss +4 -0
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +54 -3
- package/nationalarchives/all.scss +8 -4
- package/nationalarchives/assets/images/footer/facebook.svg +11 -0
- package/nationalarchives/assets/images/footer/flickr.svg +11 -0
- package/nationalarchives/assets/images/footer/instagram.svg +17 -0
- package/nationalarchives/assets/images/footer/rss.svg +13 -0
- package/nationalarchives/assets/images/footer/twitter.svg +14 -0
- package/nationalarchives/assets/images/footer/youtube.svg +12 -0
- package/nationalarchives/assets/images/tna-square-logo.svg +5 -24
- package/nationalarchives/components/_index.scss +13 -0
- package/nationalarchives/components/breadcrumbs/_index.scss +28 -6
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -2
- package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
- package/nationalarchives/components/breadcrumbs/macro.njk +1 -1
- package/nationalarchives/components/breadcrumbs/template.njk +14 -13
- package/nationalarchives/components/button/_index.scss +23 -11
- package/nationalarchives/components/button/button.stories.js +1 -2
- package/nationalarchives/components/button/fixtures.json +5 -5
- package/nationalarchives/components/button/macro.njk +1 -1
- package/nationalarchives/components/card/_index.scss +51 -7
- package/nationalarchives/components/card/card.js +2 -0
- package/nationalarchives/components/card/card.js.map +1 -0
- package/nationalarchives/components/card/card.mjs +45 -0
- package/nationalarchives/components/card/card.stories.js +18 -15
- package/nationalarchives/components/card/fixtures.json +14 -12
- package/nationalarchives/components/card/macro-options.json +18 -0
- package/nationalarchives/components/card/macro.njk +1 -1
- package/nationalarchives/components/card/template.njk +9 -4
- package/nationalarchives/components/filters/filters.stories.js +1 -2
- package/nationalarchives/components/filters/macro.njk +1 -1
- package/nationalarchives/components/filters/template.njk +2 -2
- package/nationalarchives/components/footer/_index.scss +68 -13
- package/nationalarchives/components/footer/fixtures.json +1 -1
- package/nationalarchives/components/footer/footer.stories.js +20 -23
- package/nationalarchives/components/footer/macro-options.json +12 -6
- package/nationalarchives/components/footer/macro.njk +1 -1
- package/nationalarchives/components/footer/template.njk +26 -16
- package/nationalarchives/components/grid/_index.scss +10 -12
- package/nationalarchives/components/grid/fixtures.json +12 -12
- package/nationalarchives/components/grid/grid.stories.js +56 -3
- package/nationalarchives/components/grid/macro-options.json +30 -0
- package/nationalarchives/components/grid/macro.njk +1 -1
- package/nationalarchives/components/grid/template.njk +17 -1
- package/nationalarchives/components/header/_index.scss +269 -60
- package/nationalarchives/components/header/header.js +1 -1
- package/nationalarchives/components/header/header.js.map +1 -1
- package/nationalarchives/components/header/header.mjs +7 -12
- package/nationalarchives/components/header/header.stories.js +156 -6
- package/nationalarchives/components/header/macro-options.json +83 -5
- package/nationalarchives/components/header/macro.njk +1 -1
- package/nationalarchives/components/header/template.njk +45 -36
- package/nationalarchives/components/hero/_index.scss +36 -6
- package/nationalarchives/components/hero/fixtures.json +16 -1
- package/nationalarchives/components/hero/hero.stories.js +32 -16
- package/nationalarchives/components/hero/macro-options.json +14 -2
- package/nationalarchives/components/hero/macro.njk +1 -1
- package/nationalarchives/components/hero/template.njk +7 -5
- package/nationalarchives/components/phase-banner/_index.scss +60 -0
- package/nationalarchives/components/phase-banner/fixtures.json +81 -0
- package/nationalarchives/components/phase-banner/macro-options.json +26 -0
- package/nationalarchives/components/phase-banner/macro.njk +3 -0
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +64 -0
- package/nationalarchives/components/phase-banner/template.njk +16 -0
- package/nationalarchives/components/picture/_index.scss +77 -0
- package/nationalarchives/components/picture/fixtures.json +4 -0
- package/nationalarchives/components/picture/macro-options.json +88 -0
- package/nationalarchives/components/picture/macro.njk +3 -0
- package/nationalarchives/components/picture/picture.js +2 -0
- package/nationalarchives/components/picture/picture.js.map +1 -0
- package/nationalarchives/components/picture/picture.mjs +57 -0
- package/nationalarchives/components/picture/picture.stories.js +63 -0
- package/nationalarchives/components/picture/template.njk +42 -0
- package/nationalarchives/components/profile/_index.scss +2 -0
- package/nationalarchives/components/profile/fixtures.json +4 -0
- package/nationalarchives/components/profile/macro-options.json +14 -0
- package/nationalarchives/components/profile/macro.njk +3 -0
- package/nationalarchives/components/profile/profile.stories.js +32 -0
- package/nationalarchives/components/profile/template.njk +15 -0
- package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
- package/nationalarchives/components/sensitive-image/macro.njk +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +1 -2
- package/nationalarchives/components/tabs/_index.scss +148 -0
- package/nationalarchives/components/tabs/fixtures.json +4 -0
- package/nationalarchives/components/tabs/macro-options.json +52 -0
- package/nationalarchives/components/tabs/macro.njk +3 -0
- package/nationalarchives/components/tabs/tabs.js +2 -0
- package/nationalarchives/components/tabs/tabs.js.map +1 -0
- package/nationalarchives/components/tabs/tabs.mjs +214 -0
- package/nationalarchives/components/tabs/tabs.stories.js +302 -0
- package/nationalarchives/components/tabs/template.njk +20 -0
- package/nationalarchives/patterns/_index.scss +1 -0
- package/nationalarchives/patterns/featured-collection/_index.scss +13 -0
- package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +35 -0
- package/nationalarchives/patterns/featured-collection/macro-options.json +20 -0
- package/nationalarchives/patterns/featured-collection/macro.njk +3 -0
- package/nationalarchives/patterns/featured-collection/template.njk +96 -0
- package/nationalarchives/stories/development/contributing.mdx +39 -0
- package/nationalarchives/stories/development/dependencies.mdx +2 -0
- package/nationalarchives/stories/development/technologies.mdx +65 -0
- package/nationalarchives/stories/utilities/colour.stories.js +189 -0
- package/nationalarchives/stories/utilities/typography.mdx +1 -0
- package/nationalarchives/stories/utilities/typography.stories.js +15 -0
- package/nationalarchives/templates/layouts/_generic.njk +1 -1
- package/nationalarchives/tools/_assets.scss +5 -0
- package/nationalarchives/tools/_colour.scss +129 -0
- package/nationalarchives/tools/_grid.scss +2 -2
- package/nationalarchives/tools/_index.scss +5 -0
- package/nationalarchives/tools/_media.scss +12 -11
- package/nationalarchives/tools/_typography.scss +15 -0
- package/nationalarchives/utilities/_debug.scss +11 -0
- package/nationalarchives/utilities/_global.scss +120 -3
- package/nationalarchives/utilities/_index.scss +3 -0
- package/nationalarchives/utilities/_typography.scss +155 -111
- package/nationalarchives/variables/_assets.scss +1 -0
- package/nationalarchives/variables/_colour.scss +120 -11
- package/nationalarchives/variables/{_all.scss → _index.scss} +1 -0
- package/nationalarchives/variables/_media.scss +39 -11
- package/nationalarchives/variables/_typography.scss +1 -1
- package/package.json +18 -15
- package/nationalarchives/components/_all.scss +0 -7
- package/nationalarchives/stories/development/structure.mdx +0 -7
- package/nationalarchives/tools/_all.scss +0 -3
- package/nationalarchives/utilities/_all.scss +0 -2
@@ -1,14 +1,18 @@
|
|
1
1
|
import Header from "./template.njk";
|
2
|
-
import "./_index.scss";
|
3
2
|
import macroOptions from "./macro-options.json";
|
3
|
+
import { expect } from "@storybook/jest";
|
4
|
+
import { within, userEvent } from "@storybook/testing-library";
|
5
|
+
import { MINIMAL_VIEWPORTS } from "@storybook/addon-viewport";
|
4
6
|
|
5
7
|
const argTypes = {
|
6
|
-
|
8
|
+
logo: { control: "object" },
|
9
|
+
topNavigation: { control: "object" },
|
7
10
|
navigation: { control: "object" },
|
8
11
|
colour: {
|
9
12
|
control: "radio",
|
10
13
|
options: ["black", "yellow", "pink", "orange", "green", "blue"],
|
11
14
|
},
|
15
|
+
exit: { control: "object" },
|
12
16
|
classes: { control: "text" },
|
13
17
|
attributes: { control: "object" },
|
14
18
|
};
|
@@ -20,16 +24,29 @@ Object.keys(argTypes).forEach((argType) => {
|
|
20
24
|
});
|
21
25
|
|
22
26
|
export default {
|
23
|
-
title: "Components/Header",
|
27
|
+
title: "Work in progress/Components/Header",
|
24
28
|
argTypes,
|
29
|
+
parameters: {
|
30
|
+
chromatic: { delay: 1000 },
|
31
|
+
},
|
25
32
|
};
|
26
33
|
|
27
|
-
const Template = ({
|
34
|
+
const Template = ({
|
35
|
+
logo,
|
36
|
+
topNavigation,
|
37
|
+
navigation,
|
38
|
+
colour,
|
39
|
+
exit,
|
40
|
+
classes,
|
41
|
+
attributes,
|
42
|
+
}) => {
|
28
43
|
return Header({
|
29
44
|
params: {
|
30
|
-
|
45
|
+
logo,
|
46
|
+
topNavigation,
|
31
47
|
navigation,
|
32
48
|
colour,
|
49
|
+
exit,
|
33
50
|
classes,
|
34
51
|
attributes,
|
35
52
|
},
|
@@ -38,7 +55,24 @@ const Template = ({ strapline, navigation, colour, classes, attributes }) => {
|
|
38
55
|
|
39
56
|
export const Standard = Template.bind({});
|
40
57
|
Standard.args = {
|
41
|
-
|
58
|
+
logo: {
|
59
|
+
strapline: "Beta",
|
60
|
+
href: "#/",
|
61
|
+
},
|
62
|
+
// topNavigation: [
|
63
|
+
// {
|
64
|
+
// text: "Top item 1",
|
65
|
+
// href: "#/top-1"
|
66
|
+
// },
|
67
|
+
// {
|
68
|
+
// text: "Top item 2",
|
69
|
+
// href: "#/top-2",
|
70
|
+
// },
|
71
|
+
// {
|
72
|
+
// text: "Top item 3",
|
73
|
+
// href: "#/top-3",
|
74
|
+
// },
|
75
|
+
// ],
|
42
76
|
navigation: [
|
43
77
|
{
|
44
78
|
text: "Alpha",
|
@@ -55,5 +89,121 @@ Standard.args = {
|
|
55
89
|
},
|
56
90
|
],
|
57
91
|
colour: "yellow",
|
92
|
+
exit: {
|
93
|
+
text: "Go to the current National Archives website",
|
94
|
+
href: "#",
|
95
|
+
target: "_blank",
|
96
|
+
},
|
97
|
+
classes: "tna-header--demo",
|
98
|
+
};
|
99
|
+
|
100
|
+
export const Desktop = Template.bind({});
|
101
|
+
Desktop.parameters = {
|
102
|
+
viewport: {
|
103
|
+
defaultViewport: "tablet",
|
104
|
+
},
|
105
|
+
chromatic: {
|
106
|
+
viewports: [MINIMAL_VIEWPORTS["tablet"].styles.width.replace(/px$/, "")],
|
107
|
+
},
|
108
|
+
};
|
109
|
+
Desktop.args = {
|
110
|
+
navigation: [
|
111
|
+
{
|
112
|
+
text: "Alpha",
|
113
|
+
href: "#/alpha",
|
114
|
+
selected: true,
|
115
|
+
},
|
116
|
+
{
|
117
|
+
text: "Beta",
|
118
|
+
href: "#/beta",
|
119
|
+
},
|
120
|
+
{
|
121
|
+
text: "Gamma",
|
122
|
+
href: "#/gamma",
|
123
|
+
},
|
124
|
+
],
|
125
|
+
classes: "tna-header--demo",
|
126
|
+
};
|
127
|
+
Desktop.play = async ({ canvasElement }) => {
|
128
|
+
const navigationItems = canvasElement.querySelector(
|
129
|
+
`.tna-header__navigation-items`,
|
130
|
+
);
|
131
|
+
const navigationToggle = canvasElement.querySelector(
|
132
|
+
`.tna-header__navigation-toggle-button`,
|
133
|
+
);
|
134
|
+
|
135
|
+
await expect(navigationItems).toBeVisible();
|
136
|
+
await expect(navigationToggle).not.toBeVisible();
|
137
|
+
};
|
138
|
+
|
139
|
+
export const Mobile = Template.bind({});
|
140
|
+
Mobile.parameters = {
|
141
|
+
viewport: {
|
142
|
+
defaultViewport: "mobile2",
|
143
|
+
},
|
144
|
+
chromatic: {
|
145
|
+
viewports: [MINIMAL_VIEWPORTS["mobile2"].styles.width.replace(/px$/, "")],
|
146
|
+
},
|
147
|
+
};
|
148
|
+
Mobile.args = {
|
149
|
+
navigation: [
|
150
|
+
{
|
151
|
+
text: "Alpha",
|
152
|
+
href: "#/alpha",
|
153
|
+
selected: true,
|
154
|
+
},
|
155
|
+
{
|
156
|
+
text: "Beta",
|
157
|
+
href: "#/beta",
|
158
|
+
},
|
159
|
+
{
|
160
|
+
text: "Gamma",
|
161
|
+
href: "#/gamma",
|
162
|
+
},
|
163
|
+
],
|
58
164
|
classes: "tna-header--demo",
|
59
165
|
};
|
166
|
+
Mobile.play = async ({ args, canvasElement, step }) => {
|
167
|
+
const canvas = within(canvasElement);
|
168
|
+
|
169
|
+
const navigationItems = canvasElement.querySelector(
|
170
|
+
`.tna-header__navigation-items`,
|
171
|
+
);
|
172
|
+
const [linkA, linkB, linkC] = args.navigation.map((navigationItem) =>
|
173
|
+
canvas.getByText(navigationItem.text),
|
174
|
+
);
|
175
|
+
const navigationToggle = canvasElement.querySelector(
|
176
|
+
`.tna-header__navigation-toggle-button`,
|
177
|
+
);
|
178
|
+
|
179
|
+
await step("Initial load", async () => {
|
180
|
+
await expect(navigationItems).not.toBeVisible();
|
181
|
+
await expect(navigationToggle).toBeVisible();
|
182
|
+
await expect(navigationToggle).toHaveAttribute("aria-expanded", "false");
|
183
|
+
await expect(linkA).not.toBeVisible();
|
184
|
+
await expect(linkB).not.toBeVisible();
|
185
|
+
await expect(linkC).not.toBeVisible();
|
186
|
+
});
|
187
|
+
|
188
|
+
await step("Open the menu", async () => {
|
189
|
+
await userEvent.click(navigationToggle);
|
190
|
+
await expect(navigationItems).toBeVisible();
|
191
|
+
await expect(navigationToggle).toBeVisible();
|
192
|
+
await expect(navigationToggle).toHaveAttribute("aria-expanded", "true");
|
193
|
+
await expect(linkA).toBeVisible();
|
194
|
+
await expect(linkB).toBeVisible();
|
195
|
+
await expect(linkC).toBeVisible();
|
196
|
+
});
|
197
|
+
|
198
|
+
await step("Close the menu", async () => {
|
199
|
+
await userEvent.click(navigationToggle);
|
200
|
+
await expect(navigationItems).not.toBeVisible();
|
201
|
+
await expect(navigationToggle).toBeVisible();
|
202
|
+
await expect(navigationToggle).toHaveAttribute("aria-expanded", "false");
|
203
|
+
await expect(linkA).not.toBeVisible();
|
204
|
+
await expect(linkB).not.toBeVisible();
|
205
|
+
await expect(linkC).not.toBeVisible();
|
206
|
+
});
|
207
|
+
|
208
|
+
navigationToggle.blur();
|
209
|
+
};
|
@@ -1,9 +1,29 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
|
-
"name": "
|
4
|
-
"type": "
|
3
|
+
"name": "logo",
|
4
|
+
"type": "object",
|
5
5
|
"required": false,
|
6
|
-
"description": ""
|
6
|
+
"description": "",
|
7
|
+
"params": [
|
8
|
+
{
|
9
|
+
"name": "href",
|
10
|
+
"type": "string",
|
11
|
+
"required": false,
|
12
|
+
"description": ""
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"name": "title",
|
16
|
+
"type": "string",
|
17
|
+
"required": false,
|
18
|
+
"description": ""
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"name": "strapline",
|
22
|
+
"type": "string",
|
23
|
+
"required": false,
|
24
|
+
"description": ""
|
25
|
+
}
|
26
|
+
]
|
7
27
|
},
|
8
28
|
{
|
9
29
|
"name": "navigation",
|
@@ -37,16 +57,74 @@
|
|
37
57
|
}
|
38
58
|
]
|
39
59
|
},
|
60
|
+
{
|
61
|
+
"name": "topNavigation",
|
62
|
+
"type": "array",
|
63
|
+
"required": false,
|
64
|
+
"description": "",
|
65
|
+
"params": [
|
66
|
+
{
|
67
|
+
"name": "text",
|
68
|
+
"type": "string",
|
69
|
+
"required": true,
|
70
|
+
"description": ""
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"name": "href",
|
74
|
+
"type": "string",
|
75
|
+
"required": true,
|
76
|
+
"description": ""
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"name": "title",
|
80
|
+
"type": "string",
|
81
|
+
"required": false,
|
82
|
+
"description": ""
|
83
|
+
}
|
84
|
+
]
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"name": "colour",
|
88
|
+
"type": "string",
|
89
|
+
"required": false,
|
90
|
+
"description": ""
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"name": "exit",
|
94
|
+
"type": "object",
|
95
|
+
"required": false,
|
96
|
+
"description": "",
|
97
|
+
"params": [
|
98
|
+
{
|
99
|
+
"name": "text",
|
100
|
+
"type": "string",
|
101
|
+
"required": true,
|
102
|
+
"description": ""
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"name": "href",
|
106
|
+
"type": "string",
|
107
|
+
"required": true,
|
108
|
+
"description": ""
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"name": "target",
|
112
|
+
"type": "string",
|
113
|
+
"required": false,
|
114
|
+
"description": ""
|
115
|
+
}
|
116
|
+
]
|
117
|
+
},
|
40
118
|
{
|
41
119
|
"name": "classes",
|
42
120
|
"type": "string",
|
43
121
|
"required": false,
|
44
|
-
"description": "Classes to add to the
|
122
|
+
"description": "Classes to add to the header."
|
45
123
|
},
|
46
124
|
{
|
47
125
|
"name": "attributes",
|
48
126
|
"type": "object",
|
49
127
|
"required": false,
|
50
|
-
"description": "HTML attributes (for example data attributes) to add to the
|
128
|
+
"description": "HTML attributes (for example data attributes) to add to the header."
|
51
129
|
}
|
52
130
|
]
|
@@ -1,53 +1,62 @@
|
|
1
|
-
{%- set
|
1
|
+
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
2
2
|
{%- if params.colour -%}
|
3
|
-
{%- set
|
3
|
+
{%- set containerClasses = containerClasses.concat('tna-header--' + params.colour) -%}
|
4
4
|
{%- endif -%}
|
5
|
-
<header class="tna-header {{
|
5
|
+
<header class="tna-header {{ containerClasses | join(' ') }}" data-module="tna-header" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
6
|
+
{%- if params.exit -%}
|
7
|
+
<div class="tna-header__exit">
|
8
|
+
<div class="tna-container">
|
9
|
+
<div class="tna-column tna-column--full">
|
10
|
+
<a href="{{ params.exit.href }}" class="tna-header__exit-link"{%- if params.exit.target -%} target="{{ params.exit.target }}"{%- endif -%}>
|
11
|
+
{{ params.exit.text }}
|
12
|
+
{%- if params.exit.target == "_blank" -%}
|
13
|
+
<span class="tna-header__exit-link-icon"></span>
|
14
|
+
{%- endif -%}
|
15
|
+
</a>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
{%- endif -%}
|
6
20
|
<div class="tna-container tna-header__contents">
|
7
21
|
<div class="tna-column tna-header__logo">
|
8
|
-
<a href="
|
9
|
-
<svg
|
10
|
-
<
|
22
|
+
<{%- if params.logo.href -%}a href="{{ params.logo.href }}" class="tna-header__logo-link tna-header__logo-link--href" title="{%- if params.logo.title -%}{{ params.logo.title }}{%- else -%}The National Archives{%- if params.logo.strapline %} - {{ params.logo.strapline }}{%- endif -%}{%- endif -%}"{%- else -%}span class="tna-header__logo-link"{%- endif -%}>
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" class="tna-logo" style="enable-background:new 0 0 160 160" viewBox="0 0 160 160" width="100" height="100">
|
24
|
+
<path fill="#fff" d="M0 0h160v160H0z" class="tna-logo__background"/>
|
11
25
|
<g class="tna-logo__foreground" fill="#000">
|
12
|
-
<path d="M1.9
|
13
|
-
<
|
14
|
-
<polygon points="31.6,16.5 35,16.5 35,25.5 43.4,25.5 43.4,16.5 46.8,16.5 46.8,37.9 43.4,37.9 43.4,28.6 35,28.6 35,37.9 31.6,37.9 "/>
|
15
|
-
<polygon points="50.9,16.5 63.1,16.5 63.1,19.5 54.3,19.5 54.3,25.6 61.7,25.6 61.7,28.6 54.3,28.6 54.3,34.9 63.1,34.9 63.1,37.9 50.9,37.9 "/>
|
16
|
-
<path d="M19.7,69.2h3.8l6.4,12.5c0.6,1.1,1.1,2.7,1.6,4h0.2c-0.2-1.7-0.3-3.6-0.3-4.8V69.2h3.5v21.4h-3.7l-6.3-12.3c-0.7-1.4-1.2-2.7-1.7-4.2h-0.2c0.2,1.4,0.3,3.3,0.3,5v11.5h-3.5C19.7,90.6,19.7,69.2,19.7,69.2z"/>
|
17
|
-
<path d="M47.8,82.6l-1.7-6.3c-0.3-1.1-0.6-2.2-0.9-3.8H45c-0.3,1.6-0.5,2.6-0.8,3.8l-1.7,6.3H47.8z M43,69.2h4.2l6.2,21.4h-3.5l-1.5-5.2h-6.6l-1.4,5.2h-3.6L43,69.2z"/>
|
18
|
-
<polygon points="57.2,72.3 51.8,72.3 51.8,69.2 66,69.2 66,72.3 60.6,72.3 60.6,90.7 57.2,90.7 "/>
|
19
|
-
<rect x="67.8" y="69.2" width="3.5" height="21.4"/>
|
20
|
-
<path d="M87.5,80c0-5.3-1.7-8-4.8-8c-3.2,0-4.8,2.7-4.8,8c0,5.2,1.6,7.9,4.8,7.9C85.9,87.9,87.5,85.2,87.5,80 M74.2,80c0-7,3-11.1,8.5-11.1c5.4,0,8.4,4.1,8.4,11.1c0,6.9-3,11-8.4,11C77.3,91,74.2,86.9,74.2,80"/>
|
21
|
-
<path d="M94.3,69.2H98l6.4,12.5c0.6,1.1,1.2,2.7,1.7,4h0.2c-0.2-1.7-0.3-3.6-0.3-4.8V69.2h3.4v21.4h-3.7l-6.3-12.3c-0.7-1.4-1.2-2.7-1.7-4.2h-0.2c0.2,1.4,0.3,3.3,0.3,5v11.5h-3.5V69.2z"/>
|
22
|
-
<path d="M122.4,82.6l-1.7-6.3c-0.3-1.1-0.6-2.2-0.9-3.8h-0.2c-0.3,1.6-0.5,2.6-0.8,3.8l-1.7,6.3H122.4z M117.6,69.2h4.2l6.2,21.4h-3.5l-1.5-5.2h-6.6l-1.4,5.2h-3.6L117.6,69.2z"/>
|
23
|
-
<polygon points="129.9,69.2 133.4,69.2 133.4,87.6 141.8,87.6 141.8,90.7 129.9,90.7 "/>
|
24
|
-
<path d="M26.9,135.2l-1.7-6.3c-0.3-1.1-0.6-2.2-0.9-3.8h-0.2c-0.3,1.6-0.5,2.6-0.8,3.8l-1.7,6.3H26.9z M22.1,121.8h4.2l6.2,21.4H29l-1.5-5.2h-6.6l-1.4,5.2h-3.6L22.1,121.8z"/>
|
25
|
-
<path d="M39.9,132.5c2.5,0,3.4-1.6,3.4-3.9c0-2.2-1-3.8-3.4-3.8h-2.7v7.7H39.9z M33.8,121.8h6.4c4.5,0,6.7,2.4,6.7,6.6c0,3.1-1.5,5.6-3.7,6.3v0.2c1,1.1,4,7.5,4.8,7.9v0.5h-3.8c-1-0.6-3.6-7.2-4.4-7.8h-2.5v7.8h-3.5L33.8,121.8L33.8,121.8z"/>
|
26
|
-
<path d="M52.9,132.5c0,5.3,1.9,8,4.8,8c2.9,0,4-2,4-5.2l3.5,0.1c0,0.2,0.1,0.4,0.1,0.6c0,4.4-2.1,7.5-7.5,7.5c-5.2,0-8.5-3.9-8.5-11.1c0-7.1,3.3-11,8.5-11c6.4,0,7.5,4.6,7.5,7.2c0,0.3,0,0.7-0.1,0.9l-3.5,0.1c0-3.3-1.2-5.2-4-5.2C54.8,124.6,52.9,127.3,52.9,132.5"/>
|
27
|
-
<polygon points="68,121.8 71.5,121.8 71.5,130.9 79.8,130.9 79.8,121.8 83.3,121.8 83.3,143.3 79.8,143.3 79.8,133.9 71.5,133.9 71.5,143.3 68,143.3 "/>
|
28
|
-
<rect x="87.9" y="121.8" width="3.5" height="21.4"/>
|
29
|
-
<path d="M94.2,121.8h3.6l3.2,12.3c0.5,1.9,0.8,3.6,1.1,5.6h0.2c0.3-2,0.6-3.7,1.1-5.6l3.2-12.3h3.6l-6.1,21.4h-4.1L94.2,121.8z"/>
|
30
|
-
<polygon points="112.7,121.8 125,121.8 125,124.9 116.2,124.9 116.2,130.9 123.6,130.9 123.6,133.9 116.2,133.9 116.2,140.2 125,140.2 125,143.3 112.7,143.3 "/>
|
31
|
-
<path d="M130.4,136c0,0.2-0.1,0.5-0.1,0.8c0,1.9,0.8,3.7,3.4,3.7c2.1,0,3.3-1.2,3.3-2.9c0-1.6-0.7-2.4-2.2-3l-3.4-1.3c-2.4-0.9-4.2-2.4-4.2-5.7c0-3.5,2.3-6.1,6.6-6.1c5.5,0,6.4,3.6,6.4,5.9c0,0.3,0,0.7-0.1,1.1l-3.4,0.1c0-0.2,0.1-0.5,0.1-0.7c0-1.7-0.6-3.2-3-3.2c-2.1,0-3,1.2-3,2.8c0,1.7,0.9,2.5,2.2,2.9l3.5,1.3c2.6,1,4.3,2.6,4.3,5.8c0,3.6-2.4,6.1-7,6.1c-5.9,0-6.8-3.9-6.8-6.5c0-0.3,0-0.6,0.1-1L130.4,136z"/>
|
26
|
+
<path d="M1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c0-.2.1-.5.1-.7 0-1.7-.6-3.2-3-3.2-2.1 0-3 1.2-3 2.8 0 1.7.9 2.5 2.2 2.9l3.5 1.3c2.6 1 4.3 2.6 4.3 5.8 0 3.6-2.4 6.1-7 6.1-5.9 0-6.8-3.9-6.8-6.5 0-.3 0-.6.1-1l3.3-.1z"/>
|
32
28
|
</g>
|
33
29
|
</svg>
|
34
|
-
{%- if params.strapline -%}
|
35
|
-
<span class="tna-header__logo-strapline">{{ params.strapline }}</span>
|
30
|
+
{%- if params.logo.strapline -%}
|
31
|
+
<span class="tna-header__logo-strapline">{{ params.logo.strapline }}</span>
|
36
32
|
{%- endif -%}
|
37
|
-
</a>
|
38
|
-
</div>
|
39
|
-
{%- if params.navigation -%}
|
40
|
-
<div class="tna-column tna-column--flex-1- tna-header__navigation-toggle">
|
41
|
-
<!-- POPULATED BY JAVASCRIPT IF ENABLED -->
|
33
|
+
</{%- if params.logo.href -%}a{%- else -%}span{%- endif -%}>
|
42
34
|
</div>
|
35
|
+
{%- if params.navigation or params.topNavigation -%}
|
36
|
+
<div class="tna-column tna-column--flex-1- tna-header__navigation-toggle"><!-- POPULATED BY JAVASCRIPT IF ENABLED --></div>
|
43
37
|
<nav class="tna-column tna-column--flex-1 tna-column--full-small tna-column--full-tiny tna-header__navigation" aria-label="Main site navigation">
|
38
|
+
{%- if params.navigation -%}
|
44
39
|
<ul class="tna-header__navigation-items">
|
45
|
-
|
40
|
+
{%- for item in params.navigation -%}
|
46
41
|
<li class="tna-header__navigation-item">
|
47
|
-
<a href="{{ item.href }}" class="tna-header__navigation-item-link{%- if item.selected %} tna-header__navigation-item-link--selected{% endif %}" tabindex="0" {%- if item.selected %} aria-current="true"{% endif %} {%- if item.title %} title="{{ item.title }}"{% endif %}>
|
42
|
+
<a href="{{ item.href }}" class="tna-header__navigation-item-link{%- if item.selected %} tna-header__navigation-item-link--selected{% endif %}" tabindex="0" {%- if item.selected %} aria-current="true"{% endif %} {%- if item.title %} title="{{ item.title }}"{% endif %}>
|
43
|
+
{{ item.text }}
|
44
|
+
</a>
|
45
|
+
</li>
|
46
|
+
{%- endfor -%}
|
47
|
+
</ul>
|
48
|
+
{%- endif -%}
|
49
|
+
{%- if params.topNavigation -%}
|
50
|
+
<ul class="tna-header__top-navigation-items">
|
51
|
+
{%- for item in params.topNavigation -%}
|
52
|
+
<li class="tna-header__top-navigation-item">
|
53
|
+
<a href="{{ item.href }}" class="tna-header__top-navigation-item-link" tabindex="0" {%- if item.title %} title="{{ item.title }}"{% endif %}>
|
54
|
+
{{ item.text }}
|
55
|
+
</a>
|
48
56
|
</li>
|
49
|
-
|
57
|
+
{%- endfor -%}
|
50
58
|
</ul>
|
59
|
+
{%- endif -%}
|
51
60
|
</nav>
|
52
61
|
{%- endif -%}
|
53
62
|
</div>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@use "../../utilities/global"; // To get %tna-invert
|
2
|
+
@use "../../tools/colour";
|
1
3
|
@use "../../tools/media";
|
2
4
|
|
3
5
|
.tna-hero {
|
@@ -5,14 +7,11 @@
|
|
5
7
|
padding-top: 5.25rem;
|
6
8
|
padding-bottom: 3.25rem;
|
7
9
|
|
8
|
-
display: -ms-flexbox;
|
9
10
|
display: flex;
|
10
11
|
align-items: flex-end;
|
11
12
|
|
12
13
|
position: relative;
|
13
14
|
|
14
|
-
background-color: #26262a; // Variable
|
15
|
-
|
16
15
|
&__image {
|
17
16
|
width: 100%;
|
18
17
|
height: 100%;
|
@@ -36,6 +35,8 @@
|
|
36
35
|
right: 1.25rem;
|
37
36
|
bottom: 1.25rem;
|
38
37
|
z-index: 3;
|
38
|
+
|
39
|
+
@include colour.colour-font("font-base");
|
39
40
|
}
|
40
41
|
|
41
42
|
&__image-details-summary {
|
@@ -88,7 +89,7 @@
|
|
88
89
|
&__content-inner {
|
89
90
|
padding: 2.5rem 1.5rem;
|
90
91
|
|
91
|
-
background-
|
92
|
+
@include colour.colour-background("page-background");
|
92
93
|
}
|
93
94
|
|
94
95
|
&__heading {
|
@@ -96,6 +97,7 @@
|
|
96
97
|
}
|
97
98
|
|
98
99
|
&__body {
|
100
|
+
margin-top: 1.5rem;
|
99
101
|
}
|
100
102
|
|
101
103
|
@include media.on-mobile {
|
@@ -103,6 +105,9 @@
|
|
103
105
|
|
104
106
|
display: block;
|
105
107
|
|
108
|
+
@include colour.invert;
|
109
|
+
// @extend %tna-invert;
|
110
|
+
|
106
111
|
&__image {
|
107
112
|
height: 320px;
|
108
113
|
|
@@ -132,15 +137,19 @@
|
|
132
137
|
}
|
133
138
|
|
134
139
|
&__content-inner {
|
135
|
-
|
140
|
+
padding: 1.5rem 0;
|
136
141
|
|
137
|
-
background-color:
|
142
|
+
background-color: transparent;
|
138
143
|
}
|
139
144
|
|
140
145
|
&__heading {
|
146
|
+
color: inherit;
|
141
147
|
}
|
142
148
|
|
143
149
|
&__body {
|
150
|
+
margin-top: 1rem;
|
151
|
+
|
152
|
+
color: inherit;
|
144
153
|
}
|
145
154
|
}
|
146
155
|
|
@@ -149,4 +158,25 @@
|
|
149
158
|
height: 240px;
|
150
159
|
}
|
151
160
|
}
|
161
|
+
|
162
|
+
@mixin high-contrast {
|
163
|
+
&__content-inner {
|
164
|
+
border: 1px transparent solid;
|
165
|
+
@include colour.colour-border("keyline-dark");
|
166
|
+
|
167
|
+
@include media.on-mobile {
|
168
|
+
border: none;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
.tna-template--high-contrast-theme & {
|
174
|
+
@include high-contrast;
|
175
|
+
}
|
176
|
+
|
177
|
+
@media (prefers-contrast: more) {
|
178
|
+
.tna-template--system-theme & {
|
179
|
+
@include high-contrast;
|
180
|
+
}
|
181
|
+
}
|
152
182
|
}
|
@@ -1,4 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"component": "hero",
|
3
|
-
"fixtures": [
|
3
|
+
"fixtures": [
|
4
|
+
{
|
5
|
+
"name": "minimal",
|
6
|
+
"options": {
|
7
|
+
"heading": "Title",
|
8
|
+
"image": {
|
9
|
+
"src": "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
10
|
+
"alt": "The National Archives office",
|
11
|
+
"width": 1996,
|
12
|
+
"height": 1331
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"html": "<header class=\"tna-hero \"><img src=\"https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg\" alt=\"The National Archives office\" class=\"tna-hero__image\" width=\"1996\" height=\"1331\"><div class=\"tna-container tna-hero__inner\"><div class=\"tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny tna-hero__content\"><div class=\"tna-hero__content-inner\"><h1 class=\"tna-heading tna-heading--xl tna-hero__heading\">Title</h1></div></div></div></header>",
|
16
|
+
"hidden": false
|
17
|
+
}
|
18
|
+
]
|
4
19
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import Hero from "./template.njk";
|
2
|
-
import "./_index.scss";
|
3
2
|
import macroOptions from "./macro-options.json";
|
4
3
|
import { expect } from "@storybook/jest";
|
5
4
|
import { within, userEvent } from "@storybook/testing-library";
|
@@ -42,14 +41,16 @@ Standard.args = {
|
|
42
41
|
heading: "Title",
|
43
42
|
body: "<p>Body</p>",
|
44
43
|
image: {
|
45
|
-
src: "https://
|
46
|
-
alt: "
|
47
|
-
|
44
|
+
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
45
|
+
alt: "The National Archives office",
|
46
|
+
width: 1996,
|
47
|
+
height: 1331,
|
48
|
+
information: "An interesting photo by a famous photographer ©2023",
|
48
49
|
},
|
49
50
|
classes: "tna-hero--demo",
|
50
51
|
};
|
51
52
|
|
52
|
-
Standard.play = async ({ args, canvasElement }) => {
|
53
|
+
Standard.play = async ({ args, canvasElement, step }) => {
|
53
54
|
const canvas = within(canvasElement);
|
54
55
|
const image = canvas.getByAltText(args.image.alt);
|
55
56
|
const title = canvas.getByText(args.heading);
|
@@ -58,17 +59,32 @@ Standard.play = async ({ args, canvasElement }) => {
|
|
58
59
|
);
|
59
60
|
const information = canvas.getByText(args.image.information);
|
60
61
|
|
61
|
-
await
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
await step("Initial load", async () => {
|
63
|
+
await expect(image).toBeVisible();
|
64
|
+
await expect(title).toBeVisible();
|
65
|
+
await expect(summary).toBeVisible();
|
66
|
+
await expect(information).not.toBeVisible();
|
67
|
+
});
|
68
|
+
|
69
|
+
await step("Open information", async () => {
|
70
|
+
await userEvent.click(summary);
|
71
|
+
await expect(information).toBeVisible();
|
72
|
+
});
|
65
73
|
|
66
|
-
await
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
74
|
+
await step("Close information", async () => {
|
75
|
+
await userEvent.click(summary);
|
76
|
+
await expect(information).not.toBeVisible();
|
77
|
+
});
|
78
|
+
};
|
71
79
|
|
72
|
-
|
73
|
-
|
80
|
+
export const TitleOnly = Template.bind({});
|
81
|
+
TitleOnly.args = {
|
82
|
+
heading: "Title",
|
83
|
+
image: {
|
84
|
+
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
85
|
+
alt: "The National Archives office",
|
86
|
+
width: 1996,
|
87
|
+
height: 1331,
|
88
|
+
},
|
89
|
+
classes: "tna-hero--demo",
|
74
90
|
};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
{
|
3
3
|
"name": "heading",
|
4
4
|
"type": "string",
|
5
|
-
"required":
|
5
|
+
"required": true,
|
6
6
|
"description": ""
|
7
7
|
},
|
8
8
|
{
|
@@ -20,7 +20,7 @@
|
|
20
20
|
{
|
21
21
|
"name": "image",
|
22
22
|
"type": "object",
|
23
|
-
"required":
|
23
|
+
"required": true,
|
24
24
|
"description": "",
|
25
25
|
"params": [
|
26
26
|
{
|
@@ -35,6 +35,18 @@
|
|
35
35
|
"required": true,
|
36
36
|
"description": ""
|
37
37
|
},
|
38
|
+
{
|
39
|
+
"name": "width",
|
40
|
+
"type": "number",
|
41
|
+
"required": true,
|
42
|
+
"description": ""
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"name": "height",
|
46
|
+
"type": "number",
|
47
|
+
"required": true,
|
48
|
+
"description": ""
|
49
|
+
},
|
38
50
|
{
|
39
51
|
"name": "information",
|
40
52
|
"type": "string",
|