@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.
- package/config/.eslintrc.js +1 -1
- package/config/.htmlvalidate.json +12 -5
- package/config/stylelint.config.js +1 -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 +0 -18
- package/nationalarchives/analytics.js +1 -1
- package/nationalarchives/analytics.js.map +1 -1
- package/nationalarchives/analytics.mjs +1 -1
- package/nationalarchives/components/_forms.scss +9 -0
- package/nationalarchives/components/_index.scss +2 -35
- package/nationalarchives/components/_presentation.scss +23 -0
- package/nationalarchives/components/accordion/accordion.css +1 -1
- package/nationalarchives/components/accordion/accordion.css.map +1 -1
- package/nationalarchives/components/accordion/accordion.js +1 -1
- package/nationalarchives/components/accordion/accordion.js.map +1 -1
- package/nationalarchives/components/accordion/accordion.mjs +1 -4
- package/nationalarchives/components/accordion/accordion.scss +4 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +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 +9 -9
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +15 -0
- package/nationalarchives/components/card/fixtures.json +74 -26
- package/nationalarchives/components/card/macro-options.json +7 -7
- package/nationalarchives/components/card/template.njk +7 -4
- package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
- package/nationalarchives/components/checkboxes/macro-options.json +6 -0
- package/nationalarchives/components/compound-filters/compound-filters.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/date-input/date-input.css +1 -1
- package/nationalarchives/components/date-input/date-input.css.map +1 -1
- package/nationalarchives/components/date-input/date-input.scss +2 -2
- package/nationalarchives/components/date-input/fixtures.json +5 -5
- package/nationalarchives/components/date-input/template.njk +1 -1
- package/nationalarchives/components/date-search/date-search.css +1 -1
- package/nationalarchives/components/date-search/date-search.css.map +1 -1
- package/nationalarchives/components/date-search/date-search.scss +2 -2
- package/nationalarchives/components/details/details.css.map +1 -1
- package/nationalarchives/components/details/template.njk +3 -1
- package/nationalarchives/components/error-summary/error-summary.css +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.js +1 -1
- package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
- package/nationalarchives/components/error-summary/error-summary.scss +3 -4
- package/nationalarchives/components/files-list/_index.scss +1 -0
- package/nationalarchives/components/files-list/files-list.css +1 -0
- package/nationalarchives/components/files-list/files-list.css.map +1 -0
- package/nationalarchives/components/{files/files.scss → files-list/files-list.scss} +2 -7
- package/nationalarchives/components/files-list/fixtures.json +74 -0
- package/nationalarchives/components/{files → files-list}/macro-options.json +6 -0
- package/nationalarchives/components/files-list/macro.njk +3 -0
- package/nationalarchives/components/files-list/template.njk +33 -0
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.js +1 -1
- package/nationalarchives/components/footer/footer.js.map +1 -1
- package/nationalarchives/components/gallery/fixtures.json +1 -1
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.js +1 -1
- package/nationalarchives/components/gallery/gallery.js.map +1 -1
- package/nationalarchives/components/gallery/gallery.scss +36 -29
- package/nationalarchives/components/gallery/template.njk +10 -8
- package/nationalarchives/components/global-header/global-header.css.map +1 -1
- package/nationalarchives/components/global-header/global-header.js +1 -1
- package/nationalarchives/components/global-header/global-header.js.map +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.js +1 -1
- package/nationalarchives/components/header/header.js.map +1 -1
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +0 -24
- 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.scss +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/picture/picture.js +1 -1
- package/nationalarchives/components/picture/picture.js.map +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
- package/nationalarchives/components/radios/radios.css +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/radios/radios.scss +1 -1
- package/nationalarchives/components/records-list/_index.scss +1 -0
- package/nationalarchives/components/records-list/fixtures.json +42 -0
- package/nationalarchives/components/records-list/macro.njk +3 -0
- package/nationalarchives/components/records-list/records-list.css +1 -0
- package/nationalarchives/components/records-list/records-list.css.map +1 -0
- package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +1 -1
- package/nationalarchives/components/records-list/template.njk +21 -0
- package/nationalarchives/components/search-field/search-field.css +1 -1
- package/nationalarchives/components/search-field/search-field.css.map +1 -1
- package/nationalarchives/components/search-field/search-field.scss +1 -1
- package/nationalarchives/components/select/select.css +1 -1
- package/nationalarchives/components/select/select.css.map +1 -1
- package/nationalarchives/components/select/select.scss +2 -2
- package/nationalarchives/components/sidebar/fixtures.json +12 -2
- package/nationalarchives/components/sidebar/sidebar.css +1 -1
- package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
- package/nationalarchives/components/sidebar/template.njk +9 -0
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.js +1 -1
- package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.js +1 -1
- package/nationalarchives/components/tabs/tabs.js.map +1 -1
- package/nationalarchives/components/text-input/text-input.css +1 -1
- package/nationalarchives/components/text-input/text-input.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.scss +2 -2
- package/nationalarchives/components/textarea/textarea.css +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.scss +2 -2
- package/nationalarchives/components/warning/warning.css +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/components/warning/warning.scss +1 -0
- package/nationalarchives/global-header-package.css +1 -1
- package/nationalarchives/global-header-package.css.map +1 -1
- package/nationalarchives/global-header-package.scss +1 -1
- package/nationalarchives/print.css +1 -1
- package/nationalarchives/print.css.map +1 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/templates/fixtures.json +1 -1
- package/nationalarchives/tools/_colour.scss +28 -53
- package/nationalarchives/utilities/_columns.scss +1 -1
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_reset.scss +2 -8
- package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
- package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
- package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +6 -1
- package/nationalarchives/utilities/grid/macro.njk +3 -0
- package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +27 -9
- package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +2 -2
- package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +20 -8
- package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +30 -10
- package/nationalarchives/variables/_colour.scss +12 -5
- package/package.json +3 -3
- package/nationalarchives/components/accordion/accordion.stories.js +0 -432
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
- package/nationalarchives/components/button/button-group.stories.js +0 -114
- package/nationalarchives/components/button/button.stories.js +0 -207
- package/nationalarchives/components/card/card.stories.js +0 -402
- package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
- package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
- package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
- package/nationalarchives/components/date-input/date-input.stories.js +0 -119
- package/nationalarchives/components/date-search/date-search.stories.js +0 -124
- package/nationalarchives/components/details/details.stories.js +0 -33
- package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
- package/nationalarchives/components/featured-records/_index.scss +0 -1
- package/nationalarchives/components/featured-records/featured-records.css +0 -1
- package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
- package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
- package/nationalarchives/components/featured-records/fixtures.json +0 -42
- package/nationalarchives/components/featured-records/macro.njk +0 -3
- package/nationalarchives/components/featured-records/template.njk +0 -21
- package/nationalarchives/components/files/_index.scss +0 -1
- package/nationalarchives/components/files/files.css +0 -1
- package/nationalarchives/components/files/files.css.map +0 -1
- package/nationalarchives/components/files/files.stories.js +0 -59
- package/nationalarchives/components/files/fixtures.json +0 -71
- package/nationalarchives/components/files/macro.njk +0 -3
- package/nationalarchives/components/files/template.njk +0 -33
- package/nationalarchives/components/footer/footer.stories.js +0 -241
- package/nationalarchives/components/gallery/gallery.stories.js +0 -87
- package/nationalarchives/components/global-header/global-header.stories.js +0 -364
- package/nationalarchives/components/grid/_index.scss +0 -1
- package/nationalarchives/components/grid/grid.css +0 -1
- package/nationalarchives/components/grid/grid.css.map +0 -1
- package/nationalarchives/components/grid/grid.stories.js +0 -279
- package/nationalarchives/components/grid/macro.njk +0 -3
- package/nationalarchives/components/header/header.stories.js +0 -239
- package/nationalarchives/components/hero/hero.stories.js +0 -326
- package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
- package/nationalarchives/components/pagination/pagination.stories.js +0 -532
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
- package/nationalarchives/components/picture/picture.stories.js +0 -75
- package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
- package/nationalarchives/components/radios/radios.stories.js +0 -244
- package/nationalarchives/components/search-field/search-field.stories.js +0 -88
- package/nationalarchives/components/search-filters/_index.scss +0 -1
- package/nationalarchives/components/search-filters/fixtures.json +0 -16
- package/nationalarchives/components/search-filters/macro-options.json +0 -39
- package/nationalarchives/components/search-filters/macro.njk +0 -3
- package/nationalarchives/components/search-filters/search-filters.css +0 -1
- package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.js +0 -2
- package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
- package/nationalarchives/components/search-filters/search-filters.scss +0 -198
- package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
- package/nationalarchives/components/search-filters/template.njk +0 -108
- package/nationalarchives/components/select/select.stories.js +0 -197
- package/nationalarchives/components/sensitive-image/_index.scss +0 -1
- package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
- package/nationalarchives/components/sensitive-image/macro-options.json +0 -58
- package/nationalarchives/components/sensitive-image/macro.njk +0 -3
- package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
- package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
- package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
- package/nationalarchives/components/sensitive-image/template.njk +0 -11
- package/nationalarchives/components/sidebar/sidebar.stories.js +0 -227
- package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
- package/nationalarchives/components/tabs/tabs.stories.js +0 -300
- package/nationalarchives/components/text-input/text-input.stories.js +0 -188
- package/nationalarchives/components/textarea/textarea.stories.js +0 -130
- package/nationalarchives/components/warning/warning.stories.js +0 -39
- package/nationalarchives/stories/intro.mdx +0 -13
- package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
- package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1513
- package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
- package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
- package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
- package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
- package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
- package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
- /package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/template.njk +0 -0
@@ -1,364 +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
|
-
collapseOnMedium: { control: "boolean" },
|
11
|
-
classes: { control: "text" },
|
12
|
-
attributes: { control: "object" },
|
13
|
-
};
|
14
|
-
|
15
|
-
Object.keys(argTypes).forEach((argType) => {
|
16
|
-
argTypes[argType].description = macroOptions.find(
|
17
|
-
(option) => option.name === argType,
|
18
|
-
)?.description;
|
19
|
-
});
|
20
|
-
|
21
|
-
export default {
|
22
|
-
title: "Components/Global header",
|
23
|
-
argTypes,
|
24
|
-
parameters: {
|
25
|
-
chromatic: { delay: 1000 },
|
26
|
-
},
|
27
|
-
};
|
28
|
-
|
29
|
-
const Template = ({
|
30
|
-
logo,
|
31
|
-
topNavigation,
|
32
|
-
navigation,
|
33
|
-
collapseOnMedium,
|
34
|
-
classes,
|
35
|
-
attributes,
|
36
|
-
}) =>
|
37
|
-
Header({
|
38
|
-
params: {
|
39
|
-
logo,
|
40
|
-
topNavigation,
|
41
|
-
navigation,
|
42
|
-
collapseOnMedium,
|
43
|
-
classes,
|
44
|
-
attributes,
|
45
|
-
},
|
46
|
-
});
|
47
|
-
|
48
|
-
export const Standard = Template.bind({});
|
49
|
-
Standard.args = {
|
50
|
-
logo: {
|
51
|
-
href: "#/",
|
52
|
-
},
|
53
|
-
topNavigation: [
|
54
|
-
{
|
55
|
-
text: "Search",
|
56
|
-
href: "https://www.nationalarchives.gov.uk/search/",
|
57
|
-
icon: "search",
|
58
|
-
},
|
59
|
-
{
|
60
|
-
text: "Shop",
|
61
|
-
href: "https://shop.nationalarchives.gov.uk/",
|
62
|
-
icon: "shop",
|
63
|
-
},
|
64
|
-
{
|
65
|
-
text: "Sign in",
|
66
|
-
href: "#/sign-in",
|
67
|
-
icon: "user",
|
68
|
-
},
|
69
|
-
],
|
70
|
-
navigation: [
|
71
|
-
{
|
72
|
-
text: "Visit",
|
73
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/",
|
74
|
-
},
|
75
|
-
{
|
76
|
-
text: "What’s on",
|
77
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/whats-on/",
|
78
|
-
},
|
79
|
-
{
|
80
|
-
text: "Explore the collection",
|
81
|
-
href: "https://beta.nationalarchives.gov.uk/explore-the-collection/",
|
82
|
-
},
|
83
|
-
{
|
84
|
-
text: "Help using the archive",
|
85
|
-
href: "https://www.nationalarchives.gov.uk/help-with-your-research/",
|
86
|
-
},
|
87
|
-
{
|
88
|
-
text: "Education",
|
89
|
-
href: "https://www.nationalarchives.gov.uk/education/",
|
90
|
-
},
|
91
|
-
{
|
92
|
-
text: "Professional guidance and services",
|
93
|
-
href: "https://www.nationalarchives.gov.uk/professional-guidance-and-services/",
|
94
|
-
},
|
95
|
-
],
|
96
|
-
classes: "tna-global-header--demo",
|
97
|
-
};
|
98
|
-
Standard.play = async ({ canvasElement }) => {
|
99
|
-
await new Promise((r) => setTimeout(r, 100));
|
100
|
-
|
101
|
-
const $navigationItems = canvasElement.querySelector(
|
102
|
-
`.tna-global-header__navigation`,
|
103
|
-
);
|
104
|
-
const $navigationToggle = canvasElement.querySelector(
|
105
|
-
`.tna-global-header__navigation-button`,
|
106
|
-
);
|
107
|
-
|
108
|
-
await expect($navigationItems).toBeVisible();
|
109
|
-
await expect($navigationToggle).not.toBeVisible();
|
110
|
-
};
|
111
|
-
|
112
|
-
export const Medium = Template.bind({});
|
113
|
-
Medium.parameters = {
|
114
|
-
viewport: {
|
115
|
-
defaultViewport: "medium",
|
116
|
-
},
|
117
|
-
chromatic: {
|
118
|
-
viewports: [customViewports["medium"].styles.width.replace(/px$/, "")],
|
119
|
-
},
|
120
|
-
};
|
121
|
-
Medium.args = {
|
122
|
-
logo: {
|
123
|
-
strapline: "Design System",
|
124
|
-
href: "#/",
|
125
|
-
},
|
126
|
-
topNavigation: [
|
127
|
-
{
|
128
|
-
text: "Search",
|
129
|
-
href: "https://www.nationalarchives.gov.uk/search/",
|
130
|
-
icon: "search",
|
131
|
-
},
|
132
|
-
{
|
133
|
-
text: "Shop",
|
134
|
-
href: "https://shop.nationalarchives.gov.uk/",
|
135
|
-
icon: "shop",
|
136
|
-
},
|
137
|
-
{
|
138
|
-
text: "Sign in",
|
139
|
-
href: "#/sign-in",
|
140
|
-
icon: "user",
|
141
|
-
},
|
142
|
-
],
|
143
|
-
navigation: [
|
144
|
-
{
|
145
|
-
text: "Visit",
|
146
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/",
|
147
|
-
},
|
148
|
-
{
|
149
|
-
text: "What’s on",
|
150
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/whats-on/",
|
151
|
-
},
|
152
|
-
{
|
153
|
-
text: "Explore the collection",
|
154
|
-
href: "https://beta.nationalarchives.gov.uk/explore-the-collection/",
|
155
|
-
},
|
156
|
-
{
|
157
|
-
text: "Help using the archive",
|
158
|
-
href: "https://www.nationalarchives.gov.uk/help-with-your-research/",
|
159
|
-
},
|
160
|
-
{
|
161
|
-
text: "Education",
|
162
|
-
href: "https://www.nationalarchives.gov.uk/education/",
|
163
|
-
},
|
164
|
-
{
|
165
|
-
text: "Professional guidance and services",
|
166
|
-
href: "https://www.nationalarchives.gov.uk/professional-guidance-and-services/",
|
167
|
-
},
|
168
|
-
],
|
169
|
-
classes: "tna-global-header--demo",
|
170
|
-
};
|
171
|
-
Medium.play = async ({ canvasElement }) => {
|
172
|
-
await new Promise((r) => setTimeout(r, 100));
|
173
|
-
|
174
|
-
const $navigationItems = canvasElement.querySelector(
|
175
|
-
`.tna-global-header__navigation`,
|
176
|
-
);
|
177
|
-
const $navigationToggle = canvasElement.querySelector(
|
178
|
-
`.tna-global-header__navigation-button`,
|
179
|
-
);
|
180
|
-
|
181
|
-
await expect($navigationItems).toBeVisible();
|
182
|
-
await expect($navigationToggle).not.toBeVisible();
|
183
|
-
};
|
184
|
-
|
185
|
-
export const MediumCollapsed = Template.bind({});
|
186
|
-
MediumCollapsed.parameters = {
|
187
|
-
viewport: {
|
188
|
-
defaultViewport: "medium",
|
189
|
-
},
|
190
|
-
chromatic: {
|
191
|
-
viewports: [customViewports["medium"].styles.width.replace(/px$/, "")],
|
192
|
-
},
|
193
|
-
};
|
194
|
-
MediumCollapsed.args = {
|
195
|
-
logo: {
|
196
|
-
strapline: "Design System",
|
197
|
-
href: "#/",
|
198
|
-
},
|
199
|
-
topNavigation: [
|
200
|
-
{
|
201
|
-
text: "Search",
|
202
|
-
href: "https://www.nationalarchives.gov.uk/search/",
|
203
|
-
icon: "search",
|
204
|
-
},
|
205
|
-
{
|
206
|
-
text: "Shop",
|
207
|
-
href: "https://shop.nationalarchives.gov.uk/",
|
208
|
-
icon: "shop",
|
209
|
-
},
|
210
|
-
{
|
211
|
-
text: "Sign in",
|
212
|
-
href: "#/sign-in",
|
213
|
-
icon: "user",
|
214
|
-
},
|
215
|
-
],
|
216
|
-
navigation: [
|
217
|
-
{
|
218
|
-
text: "Visit",
|
219
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/",
|
220
|
-
},
|
221
|
-
{
|
222
|
-
text: "What’s on",
|
223
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/whats-on/",
|
224
|
-
},
|
225
|
-
{
|
226
|
-
text: "Explore the collection",
|
227
|
-
href: "https://beta.nationalarchives.gov.uk/explore-the-collection/",
|
228
|
-
},
|
229
|
-
{
|
230
|
-
text: "Help using the archive",
|
231
|
-
href: "https://www.nationalarchives.gov.uk/help-with-your-research/",
|
232
|
-
},
|
233
|
-
{
|
234
|
-
text: "Education",
|
235
|
-
href: "https://www.nationalarchives.gov.uk/education/",
|
236
|
-
},
|
237
|
-
{
|
238
|
-
text: "Professional guidance and services",
|
239
|
-
href: "https://www.nationalarchives.gov.uk/professional-guidance-and-services/",
|
240
|
-
},
|
241
|
-
],
|
242
|
-
collapseOnMedium: true,
|
243
|
-
classes: "tna-global-header--demo",
|
244
|
-
};
|
245
|
-
|
246
|
-
export const Mobile = Template.bind({});
|
247
|
-
Mobile.parameters = {
|
248
|
-
viewport: {
|
249
|
-
defaultViewport: "small",
|
250
|
-
},
|
251
|
-
chromatic: {
|
252
|
-
viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
|
253
|
-
},
|
254
|
-
};
|
255
|
-
Mobile.args = {
|
256
|
-
logo: {
|
257
|
-
strapline: "Design System",
|
258
|
-
href: "#/",
|
259
|
-
},
|
260
|
-
topNavigation: [
|
261
|
-
{
|
262
|
-
text: "Search",
|
263
|
-
href: "https://www.nationalarchives.gov.uk/search/",
|
264
|
-
icon: "search",
|
265
|
-
},
|
266
|
-
{
|
267
|
-
text: "Shop",
|
268
|
-
href: "https://shop.nationalarchives.gov.uk/",
|
269
|
-
icon: "shop",
|
270
|
-
},
|
271
|
-
{
|
272
|
-
text: "Sign in",
|
273
|
-
href: "#/sign-in",
|
274
|
-
icon: "user",
|
275
|
-
},
|
276
|
-
],
|
277
|
-
navigation: [
|
278
|
-
{
|
279
|
-
text: "Visit",
|
280
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/",
|
281
|
-
},
|
282
|
-
{
|
283
|
-
text: "What’s on",
|
284
|
-
href: "https://www.nationalarchives.gov.uk/about/visit-us/whats-on/",
|
285
|
-
},
|
286
|
-
{
|
287
|
-
text: "Explore the collection",
|
288
|
-
href: "https://beta.nationalarchives.gov.uk/explore-the-collection/",
|
289
|
-
},
|
290
|
-
{
|
291
|
-
text: "Help using the archive",
|
292
|
-
href: "https://www.nationalarchives.gov.uk/help-with-your-research/",
|
293
|
-
},
|
294
|
-
{
|
295
|
-
text: "Education",
|
296
|
-
href: "https://www.nationalarchives.gov.uk/education/",
|
297
|
-
},
|
298
|
-
{
|
299
|
-
text: "Professional guidance and services",
|
300
|
-
href: "https://www.nationalarchives.gov.uk/professional-guidance-and-services/",
|
301
|
-
},
|
302
|
-
],
|
303
|
-
classes: "tna-global-header--demo",
|
304
|
-
};
|
305
|
-
Mobile.play = async ({ args, canvasElement, step }) => {
|
306
|
-
await new Promise((r) => setTimeout(r, 100));
|
307
|
-
|
308
|
-
const canvas = within(canvasElement);
|
309
|
-
|
310
|
-
const $navigationItems = canvasElement.querySelector(
|
311
|
-
`.tna-global-header__navigation`,
|
312
|
-
);
|
313
|
-
const [$linkA, $linkB, $linkC] = args.navigation.map((navigationItem) =>
|
314
|
-
canvas.getByText(navigationItem.text),
|
315
|
-
);
|
316
|
-
const $navigationToggle = canvasElement.querySelector(
|
317
|
-
`.tna-global-header__navigation-button`,
|
318
|
-
);
|
319
|
-
|
320
|
-
await step("Initial load", async () => {
|
321
|
-
await expect($navigationItems).not.toBeVisible();
|
322
|
-
await expect($navigationToggle).toBeVisible();
|
323
|
-
await expect($navigationToggle).toHaveAttribute("aria-expanded", "false");
|
324
|
-
await expect($linkA).not.toBeVisible();
|
325
|
-
await expect($linkB).not.toBeVisible();
|
326
|
-
await expect($linkC).not.toBeVisible();
|
327
|
-
});
|
328
|
-
|
329
|
-
await step("Open the menu", async () => {
|
330
|
-
await userEvent.click($navigationToggle);
|
331
|
-
await expect($navigationItems).toBeVisible();
|
332
|
-
await expect($navigationToggle).toBeVisible();
|
333
|
-
await expect($navigationToggle).toHaveAttribute("aria-expanded", "true");
|
334
|
-
await expect($linkA).toBeVisible();
|
335
|
-
await expect($linkB).toBeVisible();
|
336
|
-
await expect($linkC).toBeVisible();
|
337
|
-
});
|
338
|
-
|
339
|
-
await step("Close the menu", async () => {
|
340
|
-
await userEvent.click($navigationToggle);
|
341
|
-
await expect($navigationItems).not.toBeVisible();
|
342
|
-
await expect($navigationToggle).toBeVisible();
|
343
|
-
await expect($navigationToggle).toHaveAttribute("aria-expanded", "false");
|
344
|
-
await expect($linkA).not.toBeVisible();
|
345
|
-
await expect($linkB).not.toBeVisible();
|
346
|
-
await expect($linkC).not.toBeVisible();
|
347
|
-
});
|
348
|
-
|
349
|
-
// await step("Open the menu", async () => {
|
350
|
-
// await userEvent.click($navigationToggle);
|
351
|
-
// });
|
352
|
-
|
353
|
-
// TODO
|
354
|
-
// await step("Press the escape key", async () => {
|
355
|
-
// await expect($navigationItems).not.toBeVisible();
|
356
|
-
// await expect($navigationToggle).toBeVisible();
|
357
|
-
// await expect($navigationToggle).toHaveAttribute("aria-expanded", "false");
|
358
|
-
// await expect($linkA).not.toBeVisible();
|
359
|
-
// await expect($linkB).not.toBeVisible();
|
360
|
-
// await expect($linkC).not.toBeVisible();
|
361
|
-
// });
|
362
|
-
|
363
|
-
$navigationToggle.blur();
|
364
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
@use "grid";
|
@@ -1 +0,0 @@
|
|
1
|
-
.tna-container{width:100%;max-width:1280px;margin-right:auto;margin-left:auto;padding-right:16px;padding-left:16px;display:flex;flex-wrap:wrap;align-items:stretch;justify-content:flex-start;box-sizing:border-box}.tna-container--no-padding,.tna-container--no-padding-all{max-width:1280px-64px}.tna-container--max{max-width:none}.tna-container--centred{justify-content:center}.tna-column{padding-right:16px;padding-left:16px;box-sizing:border-box}.tna-column--container{display:flex;flex-wrap:wrap;align-items:stretch;justify-content:stretch}.tna-column--align-top{align-self:flex-start}.tna-column--align-centre{align-self:center}.tna-column--align-bottom{align-self:flex-end}.tna-column--full{width:100%;flex:none}.tna-column--width-1-12{width:8.3333333333%;flex:none}.tna-column--margin-right-1-12{margin-right:8.3333333333%}.tna-column--margin-left-1-12{margin-left:8.3333333333%}.tna-column--width-1-6{width:16.6666666667%;flex:none}.tna-column--margin-right-1-6{margin-right:16.6666666667%}.tna-column--margin-left-1-6{margin-left:16.6666666667%}.tna-column--width-1-4{width:25%;flex:none}.tna-column--margin-right-1-4{margin-right:25%}.tna-column--margin-left-1-4{margin-left:25%}.tna-column--width-1-3{width:33.3333333333%;flex:none}.tna-column--margin-right-1-3{margin-right:33.3333333333%}.tna-column--margin-left-1-3{margin-left:33.3333333333%}.tna-column--width-5-12{width:41.6666666667%;flex:none}.tna-column--margin-right-5-12{margin-right:41.6666666667%}.tna-column--margin-left-5-12{margin-left:41.6666666667%}.tna-column--width-1-2{width:50%;flex:none}.tna-column--margin-right-1-2{margin-right:50%}.tna-column--margin-left-1-2{margin-left:50%}.tna-column--width-7-12{width:58.3333333333%;flex:none}.tna-column--margin-right-7-12{margin-right:58.3333333333%}.tna-column--margin-left-7-12{margin-left:58.3333333333%}.tna-column--width-2-3{width:66.6666666667%;flex:none}.tna-column--margin-right-2-3{margin-right:66.6666666667%}.tna-column--margin-left-2-3{margin-left:66.6666666667%}.tna-column--width-3-4{width:75%;flex:none}.tna-column--margin-right-3-4{margin-right:75%}.tna-column--margin-left-3-4{margin-left:75%}.tna-column--width-5-6{width:83.3333333333%;flex:none}.tna-column--margin-right-5-6{margin-right:83.3333333333%}.tna-column--margin-left-5-6{margin-left:83.3333333333%}.tna-column--width-11-12{width:91.6666666667%;flex:none}.tna-column--margin-right-11-12{margin-right:91.6666666667%}.tna-column--margin-left-11-12{margin-left:91.6666666667%}.tna-column--flex-1{width:auto;flex:1 0}.tna-column--flex-2{width:auto;flex:2 0}.tna-column--flex-3{width:auto;flex:3 0}.tna-column--order-1{order:1}.tna-column--order-2{order:2}.tna-column--order-3{order:3}.tna-column--order-4{order:4}@media(min-width: 48.0625em)and (max-width: 64em){.tna-column--full-medium{width:100%;flex:none}.tna-column--width-1-6-medium{width:16.6666666667%;flex:none}.tna-column--margin-right-1-6-medium{margin-right:16.6666666667%}.tna-column--margin-left-1-6-medium{margin-left:16.6666666667%}.tna-column--width-1-3-medium{width:33.3333333333%;flex:none}.tna-column--margin-right-1-3-medium{margin-right:33.3333333333%}.tna-column--margin-left-1-3-medium{margin-left:33.3333333333%}.tna-column--width-1-2-medium{width:50%;flex:none}.tna-column--margin-right-1-2-medium{margin-right:50%}.tna-column--margin-left-1-2-medium{margin-left:50%}.tna-column--width-2-3-medium{width:66.6666666667%;flex:none}.tna-column--margin-right-2-3-medium{margin-right:66.6666666667%}.tna-column--margin-left-2-3-medium{margin-left:66.6666666667%}.tna-column--width-5-6-medium{width:83.3333333333%;flex:none}.tna-column--margin-right-5-6-medium{margin-right:83.3333333333%}.tna-column--margin-left-5-6-medium{margin-left:83.3333333333%}.tna-column--no-margin-right-medium{margin-right:0}.tna-column--no-margin-left-medium{margin-left:0}.tna-column--flex-1-medium{width:auto;flex:1 0}.tna-column--flex-2-medium{width:auto;flex:2 0}.tna-column--flex-3-medium{width:auto;flex:3 0}.tna-column--order-1-medium{order:1}.tna-column--order-2-medium{order:2}.tna-column--order-3-medium{order:3}.tna-column--order-4-medium{order:4}}@media(max-width: 30em){.tna-container{padding-right:8px;padding-left:8px}.tna-column{padding-right:8px;padding-left:8px}}@media(min-width: 30.0625em)and (max-width: 48em){.tna-column--full-small{width:100%;flex:none}.tna-column--width-1-4-small{width:25%;flex:none}.tna-column--margin-right-1-4-small{margin-right:25%}.tna-column--margin-left-1-4-small{margin-left:25%}.tna-column--width-1-2-small{width:50%;flex:none}.tna-column--margin-right-1-2-small{margin-right:50%}.tna-column--margin-left-1-2-small{margin-left:50%}.tna-column--width-3-4-small{width:75%;flex:none}.tna-column--margin-right-3-4-small{margin-right:75%}.tna-column--margin-left-3-4-small{margin-left:75%}.tna-column--no-margin-right-small{margin-right:0}.tna-column--no-margin-left-small{margin-left:0}.tna-column--flex-1-small{width:auto;flex:1 0}.tna-column--flex-2-small{width:auto;flex:2 0}.tna-column--flex-3-small{width:auto;flex:3 0}.tna-column--order-1-small{order:1}.tna-column--order-2-small{order:2}.tna-column--order-3-small{order:3}.tna-column--order-4-small{order:4}}@media(max-width: 30em){.tna-column--full-tiny{width:100%;flex:none}.tna-column--width-1-2-tiny{width:50%;flex:none}.tna-column--margin-right-1-2-tiny{margin-right:50%}.tna-column--margin-left-1-2-tiny{margin-left:50%}.tna-column--no-margin-right-tiny{margin-right:0}.tna-column--no-margin-left-tiny{margin-left:0}.tna-column--flex-1-tiny{width:auto;flex:1 0}.tna-column--flex-2-tiny{width:auto;flex:2 0}.tna-column--flex-3-tiny{width:auto;flex:3 0}.tna-column--order-1-tiny{order:1}.tna-column--order-2-tiny{order:2}.tna-column--order-3-tiny{order:3}.tna-column--order-4-tiny{order:4}}.tna-container--no-padding,.tna-container--no-padding-all,.tna-container--no-padding-all>.tna-column,.tna-column--no-padding,.tna-column--container--no-padding-all,.tna-column--container--no-padding-all>.tna-column{padding-right:0;padding-left:0}/*# sourceMappingURL=grid.css.map */
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/components/grid/grid.scss","../../../../src/nationalarchives/variables/_grid.scss","../../../../src/nationalarchives/tools/_grid.scss","../../../../src/nationalarchives/tools/_media.scss"],"names":[],"mappings":"AAKA,eACE,WACA,UCPwB,ODQxB,kBACA,iBACA,mBACA,kBAEA,aACA,eACA,oBACA,2BAEA,sBAEA,0DAEE,sBAGF,oBACE,eAGF,wBACE,uBAIJ,YACE,mBACA,kBAEA,sBAEA,uBACE,aACA,eACA,oBACA,wBAGF,uBACE,sBAGF,0BACE,kBAGF,0BACE,oBEtBA,kBACE,WACA,UAUI,wBACE,oBACA,UAGF,+BACE,2BAGF,8BACE,0BAVF,uBACE,qBACA,UAGF,8BACE,4BAGF,6BACE,2BAVF,uBACE,UACA,UAGF,8BACE,iBAGF,6BACE,gBAVF,uBACE,qBACA,UAGF,8BACE,4BAGF,6BACE,2BAVF,wBACE,qBACA,UAGF,+BACE,4BAGF,8BACE,2BAVF,uBACE,UACA,UAGF,8BACE,iBAGF,6BACE,gBAVF,wBACE,qBACA,UAGF,+BACE,4BAGF,8BACE,2BAVF,uBACE,qBACA,UAGF,8BACE,4BAGF,6BACE,2BAVF,uBACE,UACA,UAGF,8BACE,iBAGF,6BACE,gBAVF,uBACE,qBACA,UAGF,8BACE,4BAGF,6BACE,2BAVF,yBACE,qBACA,UAGF,gCACE,4BAGF,+BACE,2BAkCN,oBACE,WAEA,SAHF,oBACE,WAEA,SAHF,oBACE,WAEA,SAKF,qBACE,MAFS,EACX,qBACE,MAFS,EACX,qBACE,MAFS,EACX,qBACE,MAFS,ECnDf,kDDZE,yBACE,WACA,UAUI,8BACE,qBACA,UAGF,qCACE,4BAGF,oCACE,2BAVF,8BACE,qBACA,UAGF,qCACE,4BAGF,oCACE,2BAVF,8BACE,UACA,UAGF,qCACE,iBAGF,oCACE,gBAVF,8BACE,qBACA,UAGF,qCACE,4BAGF,oCACE,2BAVF,8BACE,qBACA,UAGF,qCACE,4BAGF,oCACE,2BAwBN,oCACE,eAGF,mCACE,cAKF,2BACE,WAEA,SAHF,2BACE,WAEA,SAHF,2BACE,WAEA,SAKF,4BACE,MAFS,EACX,4BACE,MAFS,EACX,4BACE,MAFS,EACX,4BACE,MAFS,GCvCf,wBHSA,eACE,kBACA,iBAGF,YACE,kBACA,kBGtBF,kDDlBE,wBACE,WACA,UAUI,6BACE,UACA,UAGF,oCACE,iBAGF,mCACE,gBAVF,6BACE,UACA,UAGF,oCACE,iBAGF,mCACE,gBAVF,6BACE,UACA,UAGF,oCACE,iBAGF,mCACE,gBAwBN,mCACE,eAGF,kCACE,cAKF,0BACE,WAEA,SAHF,0BACE,WAEA,SAHF,0BACE,WAEA,SAKF,2BACE,MAFS,EACX,2BACE,MAFS,EACX,2BACE,MAFS,EACX,2BACE,MAFS,GCvCf,wBDxBE,uBACE,WACA,UAUI,4BACE,UACA,UAGF,mCACE,iBAGF,kCACE,gBAwBN,kCACE,eAGF,iCACE,cAKF,yBACE,WAEA,SAHF,yBACE,WAEA,SAHF,yBACE,WAEA,SAKF,0BACE,MAFS,EACX,0BACE,MAFS,EACX,0BACE,MAFS,EACX,0BACE,MAFS,GFXjB,uNAME,gBACA","file":"grid.css","sourcesContent":["@use \"sass:math\";\n@use \"../../variables/grid\" as gridVars;\n@use \"../../tools/media\";\n@use \"../../tools/grid\";\n\n.tna-container {\n width: 100%;\n max-width: gridVars.$largest-container-width;\n margin-right: auto;\n margin-left: auto;\n padding-right: grid.gutter-width-half();\n padding-left: grid.gutter-width-half();\n\n display: flex;\n flex-wrap: wrap;\n align-items: stretch;\n justify-content: flex-start;\n\n box-sizing: border-box;\n\n &--no-padding,\n &--no-padding-all {\n max-width: gridVars.$largest-container-width - grid.gutter-width-double();\n }\n\n &--max {\n max-width: none;\n }\n\n &--centred {\n justify-content: center;\n }\n}\n\n.tna-column {\n padding-right: grid.gutter-width-half();\n padding-left: grid.gutter-width-half();\n\n box-sizing: border-box;\n\n &--container {\n display: flex;\n flex-wrap: wrap;\n align-items: stretch;\n justify-content: stretch;\n }\n\n &--align-top {\n align-self: flex-start;\n }\n\n &--align-centre {\n align-self: center;\n }\n\n &--align-bottom {\n align-self: flex-end;\n }\n}\n\n@include grid.columns-generator(gridVars.$column-count);\n\n@include media.on-medium {\n @include grid.columns-generator(gridVars.$column-count-medium, \"medium\");\n}\n\n@include media.on-tiny {\n .tna-container {\n padding-right: grid.gutter-width-tiny-half();\n padding-left: grid.gutter-width-tiny-half();\n }\n\n .tna-column {\n padding-right: grid.gutter-width-tiny-half();\n padding-left: grid.gutter-width-tiny-half();\n }\n}\n\n@include media.on-small {\n @include grid.columns-generator(gridVars.$column-count-small, \"small\");\n}\n\n@include media.on-tiny {\n @include grid.columns-generator(gridVars.$column-count-tiny, \"tiny\");\n}\n\n.tna-container--no-padding,\n.tna-container--no-padding-all,\n.tna-container--no-padding-all > .tna-column,\n.tna-column--no-padding,\n.tna-column--container--no-padding-all,\n.tna-column--container--no-padding-all > .tna-column {\n padding-right: 0;\n padding-left: 0;\n}\n","$largest-container-width: 1280px !default;\n\n$gutter-width: 2 !default;\n$gutter-width-tiny: 1 !default;\n\n$column-count: 12;\n$column-count-medium: 6;\n$column-count-small: 4;\n$column-count-tiny: 2;\n","@use \"sass:math\";\n@use \"../variables/grid\";\n@use \"spacing\";\n\n@function gutter-width() {\n @return spacing.space(grid.$gutter-width);\n}\n\n@function gutter-width-half() {\n @return spacing.space(math.div(grid.$gutter-width, 2));\n}\n\n@function gutter-width-double() {\n @return spacing.space(grid.$gutter-width * 2);\n}\n\n@function gutter-width-tiny() {\n @return spacing.space(grid.$gutter-width-tiny);\n}\n\n@function gutter-width-tiny-half() {\n @return spacing.space(math.div(grid.$gutter-width-tiny, 2));\n}\n\n@function gutter-width-tiny-double() {\n @return spacing.space(grid.$gutter-width-tiny * 2);\n}\n\n@mixin columns-generator($count, $suffix: \"\") {\n @if $suffix != \"\" {\n $suffix: \"-\" + $suffix;\n }\n\n .tna-column {\n &--full#{$suffix} {\n width: 100%;\n flex: none;\n }\n\n @for $i from 1 through $count - 1 {\n $simplest-fraction-found: false;\n\n @for $j from math.div($count, 2) through 1 {\n @if (\n $count % $j == 0 and $i % $j == 0 and $simplest-fraction-found != true\n ) {\n &--width-#{math.div($i, $j)}-#{math.div($count, $j)}#{$suffix} {\n width: math.div(100%, $count) * $i;\n flex: none;\n }\n\n &--margin-right-#{math.div($i, $j)}-#{math.div($count, $j)}#{$suffix} {\n margin-right: math.div(100%, $count) * $i;\n }\n\n &--margin-left-#{math.div($i, $j)}-#{math.div($count, $j)}#{$suffix} {\n margin-left: math.div(100%, $count) * $i;\n }\n\n $simplest-fraction-found: true;\n }\n }\n\n @if $simplest-fraction-found != true {\n &--width-#{$i}-#{$count}#{$suffix} {\n width: math.div(100%, $count) * $i;\n flex: none;\n }\n\n &--margin-right-#{$i}-#{$count}#{$suffix} {\n margin-right: math.div(100%, $count) * $i;\n }\n\n &--margin-left-#{$i}-#{$count}#{$suffix} {\n margin-left: math.div(100%, $count) * $i;\n }\n }\n }\n\n @if $suffix != \"\" {\n &--no-margin-right#{$suffix} {\n margin-right: 0;\n }\n\n &--no-margin-left#{$suffix} {\n margin-left: 0;\n }\n }\n\n @for $i from 1 through 3 {\n &--flex-#{$i}#{$suffix} {\n width: auto;\n\n flex: $i 0;\n }\n }\n\n @for $i from 1 through 4 {\n &--order-#{$i}#{$suffix} {\n order: $i;\n }\n }\n }\n}\n","@use \"sass:math\";\n@use \"../variables/media\";\n@use \"../variables/typography\";\n\n$smallest-large-device-em: #{math.div(\n media.$largest-medium-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-medium-device-em: #{math.div(\n media.$largest-medium-device-px,\n typography.$relative-1rem-px\n )}em;\n$smallest-medium-device-em: #{math.div(\n media.$largest-small-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-small-device-em: #{math.div(\n media.$largest-small-device-px,\n typography.$relative-1rem-px\n )}em;\n$smallest-small-device-em: #{math.div(\n media.$largest-tiny-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-tiny-device-em: #{math.div(\n media.$largest-tiny-device-px,\n typography.$relative-1rem-px\n )}em;\n\n$media-large: \"(min-width: #{$smallest-large-device-em})\";\n$media-lt-large: \"(max-width: #{$largest-medium-device-em})\";\n$media-medium: \"(min-width: #{$smallest-medium-device-em}) and (max-width: #{$largest-medium-device-em})\";\n$media-gt-mobile: \"(min-width: #{$smallest-medium-device-em})\";\n$media-mobile: \"(max-width: #{$largest-small-device-em})\";\n$media-small: \"(min-width: #{$smallest-small-device-em}) and (max-width: #{$largest-small-device-em})\";\n$media-gt-tiny: \"(min-width: #{$smallest-small-device-em})\";\n$media-tiny: \"(max-width: #{$largest-tiny-device-em})\";\n\n// https://nationalarchives.github.io/design-system/styles/media/#media-queries\n@mixin on-large() {\n @media #{$media-large} {\n @content;\n }\n}\n\n@mixin on-medium() {\n @media #{$media-medium} {\n @content;\n }\n}\n\n@mixin on-small() {\n @media #{$media-small} {\n @content;\n }\n}\n\n@mixin on-tiny() {\n @media #{$media-tiny} {\n @content;\n }\n}\n\n@mixin on-larger-than-mobile() {\n @media #{$media-gt-mobile} {\n @content;\n }\n}\n\n@mixin on-larger-than-tiny() {\n @media #{$media-gt-tiny} {\n @content;\n }\n}\n\n@mixin on-smaller-than-large() {\n @media #{$media-lt-large} {\n @content;\n }\n}\n\n@mixin on-mobile() {\n @media #{$media-mobile} {\n @content;\n }\n}\n\n@mixin on-print() {\n @media print {\n @content;\n }\n}\n"]}
|
@@ -1,279 +0,0 @@
|
|
1
|
-
import Header from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
columns: { control: "object" },
|
6
|
-
maxWidth: { control: "boolean" },
|
7
|
-
noPadding: { control: "boolean" },
|
8
|
-
noPaddingAll: { control: "boolean" },
|
9
|
-
htmlElement: { control: "text" },
|
10
|
-
classes: { control: "text" },
|
11
|
-
attributes: { control: "object" },
|
12
|
-
};
|
13
|
-
|
14
|
-
Object.keys(argTypes).forEach((argType) => {
|
15
|
-
argTypes[argType].description = macroOptions.find(
|
16
|
-
(option) => option.name === argType,
|
17
|
-
)?.description;
|
18
|
-
});
|
19
|
-
|
20
|
-
export default {
|
21
|
-
title: "Components/Grid",
|
22
|
-
argTypes,
|
23
|
-
};
|
24
|
-
|
25
|
-
const Template = ({
|
26
|
-
columns,
|
27
|
-
maxWidth,
|
28
|
-
noPadding,
|
29
|
-
noPaddingAll,
|
30
|
-
htmlElement,
|
31
|
-
classes,
|
32
|
-
attributes,
|
33
|
-
}) =>
|
34
|
-
Header({
|
35
|
-
params: {
|
36
|
-
columns,
|
37
|
-
maxWidth,
|
38
|
-
noPadding,
|
39
|
-
noPaddingAll,
|
40
|
-
htmlElement,
|
41
|
-
classes,
|
42
|
-
attributes,
|
43
|
-
},
|
44
|
-
});
|
45
|
-
|
46
|
-
export const Standard = Template.bind({});
|
47
|
-
Standard.args = {
|
48
|
-
classes: "tna-grid--demo",
|
49
|
-
columns: [
|
50
|
-
{
|
51
|
-
html: "<p>Full width</p>",
|
52
|
-
width: "full",
|
53
|
-
},
|
54
|
-
{
|
55
|
-
html: "<p>Half</p>",
|
56
|
-
width: "1-2",
|
57
|
-
},
|
58
|
-
{
|
59
|
-
html: "<p>Half</p>",
|
60
|
-
width: "1-2",
|
61
|
-
},
|
62
|
-
{
|
63
|
-
html: "<p>Third</p>",
|
64
|
-
width: "1-3",
|
65
|
-
},
|
66
|
-
{
|
67
|
-
html: "<p>Third</p>",
|
68
|
-
width: "1-3",
|
69
|
-
},
|
70
|
-
{
|
71
|
-
html: "<p>Third</p>",
|
72
|
-
width: "1-3",
|
73
|
-
},
|
74
|
-
{
|
75
|
-
html: "<p>Two thirds</p>",
|
76
|
-
width: "2-3",
|
77
|
-
},
|
78
|
-
{
|
79
|
-
html: "<p>Third</p>",
|
80
|
-
width: "1-3",
|
81
|
-
},
|
82
|
-
{
|
83
|
-
html: "<p>Third</p>",
|
84
|
-
width: "1-3",
|
85
|
-
},
|
86
|
-
{
|
87
|
-
html: "<p>Two thirds</p>",
|
88
|
-
width: "2-3",
|
89
|
-
},
|
90
|
-
{
|
91
|
-
html: "<p>Quarter</p>",
|
92
|
-
width: "1-4",
|
93
|
-
},
|
94
|
-
{
|
95
|
-
html: "<p>Quarter</p>",
|
96
|
-
width: "1-4",
|
97
|
-
},
|
98
|
-
{
|
99
|
-
html: "<p>Quarter</p>",
|
100
|
-
width: "1-4",
|
101
|
-
},
|
102
|
-
{
|
103
|
-
html: "<p>Quarter</p>",
|
104
|
-
width: "1-4",
|
105
|
-
},
|
106
|
-
{
|
107
|
-
html: "<p>Half</p>",
|
108
|
-
width: "1-2",
|
109
|
-
},
|
110
|
-
{
|
111
|
-
html: "<p>Quarter</p>",
|
112
|
-
width: "1-4",
|
113
|
-
},
|
114
|
-
{
|
115
|
-
html: "<p>Quarter</p>",
|
116
|
-
width: "1-4",
|
117
|
-
},
|
118
|
-
{
|
119
|
-
html: "<p>Quarter</p>",
|
120
|
-
width: "1-4",
|
121
|
-
},
|
122
|
-
{
|
123
|
-
html: "<p>Half</p>",
|
124
|
-
width: "1-2",
|
125
|
-
},
|
126
|
-
{
|
127
|
-
html: "<p>Quarter</p>",
|
128
|
-
width: "1-4",
|
129
|
-
},
|
130
|
-
{
|
131
|
-
html: "<p>Quarter</p>",
|
132
|
-
width: "1-4",
|
133
|
-
},
|
134
|
-
{
|
135
|
-
html: "<p>Quarter</p>",
|
136
|
-
width: "1-4",
|
137
|
-
},
|
138
|
-
{
|
139
|
-
html: "<p>Half</p>",
|
140
|
-
width: "1-2",
|
141
|
-
},
|
142
|
-
{
|
143
|
-
html: "<p>Sixth</p>",
|
144
|
-
width: "1-6",
|
145
|
-
},
|
146
|
-
{
|
147
|
-
html: "<p>Sixth</p>",
|
148
|
-
width: "1-6",
|
149
|
-
},
|
150
|
-
{
|
151
|
-
html: "<p>Sixth</p>",
|
152
|
-
width: "1-6",
|
153
|
-
},
|
154
|
-
{
|
155
|
-
html: "<p>Sixth</p>",
|
156
|
-
width: "1-6",
|
157
|
-
},
|
158
|
-
{
|
159
|
-
html: "<p>Sixth</p>",
|
160
|
-
width: "1-6",
|
161
|
-
},
|
162
|
-
{
|
163
|
-
html: "<p>Sixth</p>",
|
164
|
-
width: "1-6",
|
165
|
-
},
|
166
|
-
{
|
167
|
-
html: "<p>Half</p>",
|
168
|
-
width: "1-2",
|
169
|
-
},
|
170
|
-
{
|
171
|
-
html: "<p>Third</p>",
|
172
|
-
width: "1-3",
|
173
|
-
},
|
174
|
-
{
|
175
|
-
html: "<p>Sixth</p>",
|
176
|
-
width: "1-6",
|
177
|
-
},
|
178
|
-
],
|
179
|
-
};
|
180
|
-
|
181
|
-
export const Responsive = Template.bind({});
|
182
|
-
const responsiveColumn = {
|
183
|
-
html: "<p>Responsive</p>",
|
184
|
-
width: "1-4",
|
185
|
-
widthMedium: "1-3",
|
186
|
-
widthSmall: "1-2",
|
187
|
-
widthTiny: "full",
|
188
|
-
};
|
189
|
-
Responsive.parameters = {
|
190
|
-
chromatic: { disableSnapshot: true },
|
191
|
-
};
|
192
|
-
Responsive.args = {
|
193
|
-
classes: "tna-grid--demo tna-grid--demo-tall",
|
194
|
-
columns: Array(12).fill({ ...responsiveColumn }),
|
195
|
-
};
|
196
|
-
|
197
|
-
export const Flex = Template.bind({});
|
198
|
-
Flex.parameters = {
|
199
|
-
chromatic: { disableSnapshot: true },
|
200
|
-
};
|
201
|
-
Flex.args = {
|
202
|
-
classes: "tna-grid--demo",
|
203
|
-
columns: [
|
204
|
-
{
|
205
|
-
html: "<h1>A</h1>",
|
206
|
-
width: "1-4",
|
207
|
-
},
|
208
|
-
{
|
209
|
-
html: "<h1>B</h1>",
|
210
|
-
flex: 1,
|
211
|
-
},
|
212
|
-
],
|
213
|
-
};
|
214
|
-
|
215
|
-
export const Order = Template.bind({});
|
216
|
-
Order.parameters = {
|
217
|
-
chromatic: { disableSnapshot: true },
|
218
|
-
};
|
219
|
-
Order.args = {
|
220
|
-
classes: "tna-grid--demo tna-grid--demo-tall",
|
221
|
-
columns: [
|
222
|
-
{
|
223
|
-
html: "<h1>A</h1>",
|
224
|
-
width: "1-4",
|
225
|
-
order: 1,
|
226
|
-
orderMedium: 2,
|
227
|
-
orderSmall: 3,
|
228
|
-
orderTiny: 4,
|
229
|
-
},
|
230
|
-
{
|
231
|
-
html: "<h1>B</h1>",
|
232
|
-
width: "1-4",
|
233
|
-
order: 2,
|
234
|
-
orderMedium: 1,
|
235
|
-
orderSmall: 4,
|
236
|
-
orderTiny: 3,
|
237
|
-
},
|
238
|
-
{
|
239
|
-
html: "<h1>C</h1>",
|
240
|
-
width: "1-4",
|
241
|
-
order: 3,
|
242
|
-
orderMedium: 4,
|
243
|
-
orderSmall: 1,
|
244
|
-
orderTiny: 2,
|
245
|
-
},
|
246
|
-
{
|
247
|
-
html: "<h1>D</h1>",
|
248
|
-
width: "1-4",
|
249
|
-
order: 4,
|
250
|
-
orderMedium: 3,
|
251
|
-
orderSmall: 2,
|
252
|
-
orderTiny: 1,
|
253
|
-
},
|
254
|
-
],
|
255
|
-
};
|
256
|
-
|
257
|
-
export const Margin = Template.bind({});
|
258
|
-
Margin.parameters = {
|
259
|
-
chromatic: { disableSnapshot: true },
|
260
|
-
};
|
261
|
-
Margin.args = {
|
262
|
-
classes: "tna-grid--demo",
|
263
|
-
columns: [
|
264
|
-
{
|
265
|
-
html: "<h1>A</h1>",
|
266
|
-
width: "1-4",
|
267
|
-
},
|
268
|
-
{
|
269
|
-
html: "<h1>B</h1>",
|
270
|
-
width: "1-4",
|
271
|
-
marginLeft: "1-12",
|
272
|
-
},
|
273
|
-
{
|
274
|
-
html: "<h1>C</h1>",
|
275
|
-
width: "1-4",
|
276
|
-
marginLeft: "1-6",
|
277
|
-
},
|
278
|
-
],
|
279
|
-
};
|