@nationalarchives/frontend 0.1.64 → 0.2.0
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/.babelrc.json +19 -0
- package/config/.eslintrc.js +25 -0
- package/config/.htmlvalidate.json +17 -0
- package/config/stylelint.config.js +240 -0
- package/nationalarchives/all.css +1 -3
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +34 -18
- package/nationalarchives/all.scss +0 -2
- package/nationalarchives/components/_forms.scss +9 -0
- package/nationalarchives/components/_index.scss +2 -34
- 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 +92 -24
- package/nationalarchives/components/accordion/accordion.scss +56 -18
- package/nationalarchives/components/accordion/fixtures.json +34 -7
- package/nationalarchives/components/accordion/macro-options.json +14 -2
- package/nationalarchives/components/accordion/template.njk +7 -5
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.scss +0 -10
- package/nationalarchives/components/breadcrumbs/template.njk +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 +32 -10
- package/nationalarchives/components/button/macro-options.json +6 -0
- package/nationalarchives/components/button/template.njk +3 -1
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/template.njk +5 -5
- 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/checkboxes/template.njk +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/compound-filters/template.njk +1 -1
- 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.scss +0 -2
- package/nationalarchives/components/cookie-banner/template.njk +1 -2
- 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 +2 -2
- 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.njk +2 -2
- package/nationalarchives/components/date-search/date-search.scss +2 -2
- package/nationalarchives/components/date-search/template.njk +1 -1
- package/nationalarchives/components/details/details.css.map +1 -1
- package/nationalarchives/components/details/template.njk +1 -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/error-summary/template.njk +1 -1
- 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-list/files-list.scss +80 -0
- package/nationalarchives/components/files-list/fixtures.json +71 -0
- package/nationalarchives/components/{sensitive-image → files-list}/macro-options.json +20 -20
- package/nationalarchives/components/files-list/macro.njk +3 -0
- package/nationalarchives/components/files-list/template.njk +33 -0
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.scss +0 -2
- package/nationalarchives/components/footer/macro-options.json +0 -6
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/gallery/fixtures.json +35 -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.mjs +192 -53
- package/nationalarchives/components/gallery/gallery.scss +317 -56
- package/nationalarchives/components/gallery/macro-options.json +34 -49
- package/nationalarchives/components/gallery/template.njk +74 -33
- package/nationalarchives/components/global-header/global-header.css +1 -1
- package/nationalarchives/components/global-header/global-header.css.map +1 -1
- package/nationalarchives/components/global-header/global-header.scss +0 -2
- package/nationalarchives/components/global-header/template.njk +1 -1
- package/nationalarchives/components/header/header.css +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.scss +3 -5
- package/nationalarchives/components/header/template.njk +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/hero/template.njk +1 -1
- 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/index-grid/template.njk +3 -3
- package/nationalarchives/components/pagination/pagination.css +1 -1
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.scss +1 -1
- package/nationalarchives/components/pagination/template.njk +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.scss +0 -2
- package/nationalarchives/components/phase-banner/template.njk +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/picture/picture.mjs +2 -2
- package/nationalarchives/components/picture/template.njk +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/quick-filters/template.njk +1 -1
- package/nationalarchives/components/radios/radios.css +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/radios/radios.njk +1 -1
- package/nationalarchives/components/radios/radios.scss +1 -1
- package/nationalarchives/components/radios/template.njk +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} +2 -2
- 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 +3 -2
- package/nationalarchives/components/search-field/template.njk +2 -2
- 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/select/template.njk +2 -2
- package/nationalarchives/components/sidebar/fixtures.json +18 -8
- package/nationalarchives/components/sidebar/macro-options.json +9 -2
- package/nationalarchives/components/sidebar/sidebar.css +1 -1
- package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
- package/nationalarchives/components/sidebar/template.njk +12 -3
- 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.scss +0 -2
- package/nationalarchives/components/skip-link/template.njk +1 -1
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.scss +0 -12
- package/nationalarchives/components/tabs/template.njk +1 -1
- package/nationalarchives/components/text-input/template.njk +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.njk +2 -2
- package/nationalarchives/components/text-input/text-input.scss +2 -2
- package/nationalarchives/components/textarea/template.njk +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/template.njk +1 -1
- package/nationalarchives/components/warning/warning.css +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/components/warning/warning.scss +2 -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 +6 -0
- package/nationalarchives/print.css.map +1 -0
- package/nationalarchives/print.scss +44 -0
- package/nationalarchives/prototype-kit.css +1 -3
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/templates/layouts/_generic.njk +6 -6
- package/nationalarchives/tools/_a11y.scss +4 -0
- package/nationalarchives/tools/_colour.scss +75 -79
- package/nationalarchives/tools/_media.scss +0 -10
- 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/utilities/grid/macro.njk +3 -0
- package/nationalarchives/{components → utilities}/grid/template.njk +1 -1
- package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +16 -7
- package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +8 -2
- package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +5 -5
- package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +8 -5
- package/nationalarchives/variables/_colour.scss +12 -5
- package/package.json +1 -1
- package/nationalarchives/components/accordion/accordion.stories.js +0 -410
- 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 -204
- 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/footer/footer.stories.js +0 -241
- package/nationalarchives/components/gallery/gallery.stories.js +0 -74
- 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.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 -224
- 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 -1535
- 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/grid/grid.scss → utilities/grid/_index.scss} +3 -3
- /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
@@ -1,124 +0,0 @@
|
|
1
|
-
import DateSearch from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
label: { control: "text" },
|
6
|
-
headingLevel: { control: { type: "number", min: 1, max: 6 } },
|
7
|
-
headingSize: {
|
8
|
-
control: "inline-radio",
|
9
|
-
options: ["xs", "s", "m", "l", "xl"],
|
10
|
-
},
|
11
|
-
id: { control: "text" },
|
12
|
-
name: { control: "text" },
|
13
|
-
hint: { control: "text" },
|
14
|
-
value: { control: "text" },
|
15
|
-
error: { control: "object" },
|
16
|
-
maxWidth: { control: "boolean" },
|
17
|
-
inline: { control: "boolean" },
|
18
|
-
formGroupClasses: { control: "text" },
|
19
|
-
formGroupAttributes: { control: "object" },
|
20
|
-
classes: { control: "text" },
|
21
|
-
attributes: { control: "object" },
|
22
|
-
};
|
23
|
-
|
24
|
-
Object.keys(argTypes).forEach((argType) => {
|
25
|
-
argTypes[argType].description = macroOptions.find(
|
26
|
-
(option) => option.name === argType,
|
27
|
-
)?.description;
|
28
|
-
});
|
29
|
-
|
30
|
-
export default {
|
31
|
-
title: "Components/Date search",
|
32
|
-
argTypes,
|
33
|
-
};
|
34
|
-
|
35
|
-
const Template = ({
|
36
|
-
label,
|
37
|
-
headingLevel,
|
38
|
-
headingSize,
|
39
|
-
id,
|
40
|
-
name,
|
41
|
-
hint,
|
42
|
-
value,
|
43
|
-
error,
|
44
|
-
maxWidth,
|
45
|
-
inline,
|
46
|
-
formGroupClasses,
|
47
|
-
formGroupAttributes,
|
48
|
-
classes,
|
49
|
-
attributes,
|
50
|
-
}) =>
|
51
|
-
DateSearch({
|
52
|
-
params: {
|
53
|
-
label,
|
54
|
-
headingLevel,
|
55
|
-
headingSize,
|
56
|
-
id,
|
57
|
-
name,
|
58
|
-
hint,
|
59
|
-
value,
|
60
|
-
error,
|
61
|
-
maxWidth,
|
62
|
-
inline,
|
63
|
-
formGroupClasses,
|
64
|
-
formGroupAttributes,
|
65
|
-
classes,
|
66
|
-
attributes,
|
67
|
-
},
|
68
|
-
});
|
69
|
-
|
70
|
-
export const Standard = Template.bind({});
|
71
|
-
Standard.args = {
|
72
|
-
label: "Enter a start date",
|
73
|
-
headingLevel: 4,
|
74
|
-
headingSize: "m",
|
75
|
-
id: "date1",
|
76
|
-
name: "date1",
|
77
|
-
classes: "tna-date-search--demo",
|
78
|
-
};
|
79
|
-
|
80
|
-
export const Predefined = Template.bind({});
|
81
|
-
Predefined.args = {
|
82
|
-
label: "Enter a start date",
|
83
|
-
headingLevel: 4,
|
84
|
-
headingSize: "m",
|
85
|
-
id: "date2",
|
86
|
-
name: "date2",
|
87
|
-
value: "1986-09-24",
|
88
|
-
classes: "tna-date-search--demo",
|
89
|
-
};
|
90
|
-
|
91
|
-
export const WithHint = Template.bind({});
|
92
|
-
WithHint.args = {
|
93
|
-
label: "Enter a start date",
|
94
|
-
headingLevel: 4,
|
95
|
-
headingSize: "m",
|
96
|
-
id: "date3",
|
97
|
-
name: "date3",
|
98
|
-
hint: "The earliest date of the record",
|
99
|
-
classes: "tna-date-search--demo",
|
100
|
-
};
|
101
|
-
|
102
|
-
export const Error = Template.bind({});
|
103
|
-
Error.args = {
|
104
|
-
label: "Enter a start date",
|
105
|
-
headingLevel: 4,
|
106
|
-
headingSize: "m",
|
107
|
-
id: "date4",
|
108
|
-
name: "date4",
|
109
|
-
error: {
|
110
|
-
text: "Date is not valid",
|
111
|
-
},
|
112
|
-
classes: "tna-date-search--demo",
|
113
|
-
};
|
114
|
-
|
115
|
-
export const Inline = Template.bind({});
|
116
|
-
Inline.args = {
|
117
|
-
label: "Enter a start date",
|
118
|
-
headingLevel: 4,
|
119
|
-
headingSize: "xs",
|
120
|
-
id: "date5",
|
121
|
-
name: "date5",
|
122
|
-
inline: true,
|
123
|
-
classes: "tna-date-search--demo",
|
124
|
-
};
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import Details from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
title: { control: "text" },
|
6
|
-
body: { control: "text" },
|
7
|
-
text: { control: "text" },
|
8
|
-
classes: { control: "text" },
|
9
|
-
attributes: { control: "object" },
|
10
|
-
};
|
11
|
-
|
12
|
-
Object.keys(argTypes).forEach((argType) => {
|
13
|
-
argTypes[argType].description = macroOptions.find(
|
14
|
-
(option) => option.name === argType,
|
15
|
-
)?.description;
|
16
|
-
});
|
17
|
-
|
18
|
-
export default {
|
19
|
-
title: "Components/Details",
|
20
|
-
argTypes,
|
21
|
-
};
|
22
|
-
|
23
|
-
const Template = ({ title, body, text, classes, attributes }) =>
|
24
|
-
Details({
|
25
|
-
params: { title, body, text, classes, attributes },
|
26
|
-
});
|
27
|
-
|
28
|
-
export const Standard = Template.bind({});
|
29
|
-
Standard.args = {
|
30
|
-
title: "Details",
|
31
|
-
body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim. Donec bibendum est leo, sed dapibus mauris facilisis vitae.</p><p>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit mi vel rhoncus aliquam.</p><p>Pellentesque ultrices bibendum nibh, sit amet ornare turpis efficitur id. Aenean ullamcorper neque eget justo sagittis, rutrum ultrices urna varius. Mauris sodales a lorem at sodales.</p>",
|
32
|
-
classes: "tna-details--demo",
|
33
|
-
};
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import ErrorSummary from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
title: { control: "text" },
|
6
|
-
headingLevel: { control: { type: "number", min: 1, max: 6 } },
|
7
|
-
items: { control: "object" },
|
8
|
-
disableAutoFocus: { control: "boolean" },
|
9
|
-
classes: { control: "text" },
|
10
|
-
attributes: { control: "object" },
|
11
|
-
};
|
12
|
-
|
13
|
-
Object.keys(argTypes).forEach((argType) => {
|
14
|
-
argTypes[argType].description = macroOptions.find(
|
15
|
-
(option) => option.name === argType,
|
16
|
-
)?.description;
|
17
|
-
});
|
18
|
-
|
19
|
-
export default {
|
20
|
-
title: "Components/Error summary",
|
21
|
-
argTypes,
|
22
|
-
};
|
23
|
-
|
24
|
-
const Template = ({
|
25
|
-
title,
|
26
|
-
headingLevel,
|
27
|
-
items,
|
28
|
-
disableAutoFocus,
|
29
|
-
classes,
|
30
|
-
attributes,
|
31
|
-
}) =>
|
32
|
-
ErrorSummary({
|
33
|
-
params: {
|
34
|
-
title,
|
35
|
-
headingLevel,
|
36
|
-
items,
|
37
|
-
disableAutoFocus,
|
38
|
-
classes,
|
39
|
-
attributes,
|
40
|
-
},
|
41
|
-
});
|
42
|
-
|
43
|
-
export const Standard = Template.bind({});
|
44
|
-
Standard.args = {
|
45
|
-
title: "There is a problem",
|
46
|
-
headingLevel: 2,
|
47
|
-
items: [
|
48
|
-
{
|
49
|
-
text: "Enter your full name",
|
50
|
-
href: "#",
|
51
|
-
},
|
52
|
-
{
|
53
|
-
text: "The date of the record cannot be in the future",
|
54
|
-
href: "#",
|
55
|
-
},
|
56
|
-
],
|
57
|
-
disableAutoFocus: true,
|
58
|
-
classes: "tna-error-summary--demo",
|
59
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
@use "featured-records";
|
@@ -1 +0,0 @@
|
|
1
|
-
.tna-featured-records{margin-top:32px}.tna-featured-records:first-child{margin-top:0}.tna-featured-records{margin-bottom:0;padding:0;list-style:none;border-top:5px var(--accent-border, rgb(140, 150, 148)) solid}.tna-featured-records__item{padding:16px 24px;display:flex;justify-content:flex-start;align-items:center;gap:32px;border:1px var(--keyline, rgb(38 38 42/0.25)) solid;border-top-width:0}.tna-featured-records__image{width:6rem;height:auto}.tna-featured-records__details{margin:0;flex:1}.tna-featured-records__title-label,.tna-featured-records__date-label{display:none}.tna-featured-records__collection-description,.tna-featured-records__title-description,.tna-featured-records__date-description{width:100%;margin:0}.tna-featured-records__collection-label,.tna-featured-records__collection-description{display:inline-block}.tna-featured-records__collection-label::after{content:":";content:":"/""}.tna-featured-records__title-description{padding-bottom:4px;font-family:Roboto Mono,monospace;font-style:normal;font-optical-sizing:auto;font-weight:500}.tna-featured-records__date-description{color:var(--font-light, rgb(1 1 1/0.58));font-size:1rem}@media(max-width: 30em){.tna-featured-records__item{padding:16px;flex-direction:column;align-items:flex-start;gap:16px}}/*# sourceMappingURL=featured-records.css.map */
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/tools/_spacing.scss","../../../../src/nationalarchives/components/featured-records/featured-records.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/variables/_typography.scss","../../../../src/nationalarchives/tools/_media.scss"],"names":[],"mappings":"AAUA,sBACE,gBAEA,kCACE,aCTJ,sBAEE,gBACA,UAEA,gBC4DI,8DDxDJ,4BACE,kBAEA,aACA,2BACA,mBACA,SC4DE,oDDzDF,mBAGF,6BACE,WACA,YAGF,+BACE,SAEA,OAGF,qEAEE,aAGF,+HAGE,WACA,SAGF,sFAEE,qBAIA,+CACE,YACA,eAUJ,yCACE,mBExBF,YCuBA,sBDtBA,kBACA,yBAEE,YCsBsB,IHMxB,wCC1BA,yCC5CA,eEoDA,wBJwBE,4BACE,aAEA,sBACA,uBAEA","file":"featured-records.css","sourcesContent":["@use \"sass:map\";\n@use \"sass:math\";\n@use \"../variables/spacing\";\n@use \"../variables/typography\";\n@use \"../tools/media\";\n\n@function space($size) {\n @return #{$size * spacing.$spacing-unit-px}px;\n}\n\n%space-above {\n margin-top: space(2);\n\n &:first-child {\n margin-top: 0;\n }\n}\n\n%space-only-above {\n margin: #{space(2)} 0 0;\n\n &:first-child {\n margin-top: 0;\n }\n}\n\n@mixin space-above($zero-other-margins: false) {\n @if $zero-other-margins {\n @extend %space-only-above;\n } @else {\n @extend %space-above;\n }\n}\n\n@mixin no-spacing-generator($suffix: \"\") {\n @if $suffix != \"\" {\n $suffix: \"-\" + $suffix;\n }\n @each $property in margin, padding {\n @each $direction in top, bottom {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix},\n .tna-\\!--no-#{$property}-#{$combined-direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n } @else {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n }\n }\n }\n}\n\n@mixin spacing-generator($suffix: \"\") {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n\n @include media.on-mobile {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing-mobile {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n }\n}\n","@use \"../../tools/colour\";\n@use \"../../tools/media\";\n@use \"../../tools/spacing\";\n@use \"../../tools/typography\";\n\n.tna-featured-records {\n @include spacing.space-above;\n margin-bottom: 0;\n padding: 0;\n\n list-style: none;\n\n @include colour.thick-keyline-accent(top);\n\n &__item {\n padding: spacing.space(1) spacing.space(1.5);\n\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: spacing.space(2);\n\n @include colour.colour-border(\"keyline\", 1px);\n border-top-width: 0;\n }\n\n &__image {\n width: 6rem;\n height: auto;\n }\n\n &__details {\n margin: 0;\n\n flex: 1;\n }\n\n &__title-label,\n &__date-label {\n display: none;\n }\n\n &__collection-description,\n &__title-description,\n &__date-description {\n width: 100%;\n margin: 0;\n }\n\n &__collection-label,\n &__collection-description {\n display: inline-block;\n }\n\n &__collection-label {\n &::after {\n content: \":\";\n content: \":\" / \"\";\n }\n }\n\n &__collection-description {\n }\n\n &__title-label {\n }\n\n &__title-description {\n padding-bottom: spacing.space(0.25);\n\n @include typography.detail-font(true);\n }\n\n &__date-label {\n }\n\n &__date-description {\n @include colour.colour-font(\"font-light\");\n @include typography.font-size(16);\n }\n\n @include media.on-tiny {\n &__item {\n padding: spacing.space(1);\n\n flex-direction: column;\n align-items: flex-start;\n\n gap: spacing.space(1);\n }\n }\n}\n","@use \"sass:list\";\n@use \"sass:map\";\n@use \"../variables/borders\";\n@use \"../variables/colour\";\n@use \"../tools/media\";\n\n@function brand-colour($colour, $opacity: 1) {\n @return colour.brand-colour($colour, $opacity);\n}\n\n@mixin colour-css-vars($excludes...) {\n @each $name, $value in colour.$colour-palette-default {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n }\n }\n}\n\n@mixin colour-css-vars-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n }\n }\n}\n\n@function colour-var($colour) {\n @return var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n );\n}\n\n@mixin colour-font($colour, $important: false) {\n color: colour-var($colour) if($important, !important, null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: colour-var($colour) if($important, !important, null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)} if($important, !important, null);\n}\n\n@mixin colour-border(\n $colour,\n $width: \"\",\n $style: solid,\n $direction: \"\",\n $important: false\n) {\n @if $direction != \"\" {\n @if $width != \"\" {\n border-#{$direction}: $width\n colour-var($colour)\n $style\n if($important, !important, null);\n } @else {\n border-#{$direction}-color: colour-var($colour)\n if($important, !important, null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n colour-var($colour)\n $style\n if($important, !important, null);\n } @else {\n border-color: var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n )\n if($important, !important, null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width colour-var($colour) $style if($important, !important, null);\n } @else {\n outline-color: colour-var($colour) if($important, !important, null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: colour-var($colour) if($important, !important, null);\n}\n\n@mixin thick-keyline($direction) {\n @include colour-border(\n \"keyline\",\n borders.$thick-border-width,\n solid,\n $direction\n );\n}\n\n@mixin thick-keyline-dark($direction) {\n @include colour-border(\n \"keyline-dark\",\n borders.$thick-border-width,\n solid,\n $direction\n );\n}\n\n@mixin thick-keyline-accent($direction) {\n @include colour-border(\n \"accent-border\",\n borders.$thick-border-width,\n solid,\n $direction\n );\n}\n\n@mixin thick-keyline-error($direction) {\n @include colour-border(\n \"form-error\",\n borders.$thick-border-width,\n solid,\n $direction\n );\n}\n\n@mixin thick-keyline-brand($direction, $brandColour) {\n border-#{$direction}: borders.$thick-border-width #{brand-colour($brandColour)}\n solid;\n}\n\n// Use light theme colours (except for \"form-error\")\n%light {\n @include colour-css-vars(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n}\n\n@mixin light {\n @extend %light;\n}\n\n%contrast {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-list-marker: var(--accent-border);\n // --accent-list-marker: var(--font-base);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin contrast {\n @extend %contrast;\n}\n\n%contrast-on-mobile {\n @include media.on-mobile {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-list-marker: var(--accent-border);\n // --accent-list-marker: var(--font-base);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\n}\n\n%tint {\n --background: var(--background-tint);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent {\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-list-marker: var(--accent-font-base);\n --accent-border: var(--accent-font-dark);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%accent-light {\n --background: var(--accent-background-light);\n --font-base: #{map.get(colour.$colour-palette-default, \"font-base\")};\n --font-dark: #{map.get(colour.$colour-palette-default, \"font-dark\")};\n --font-light: #{map.get(colour.$colour-palette-default, \"font-light\")};\n --icon-light: #{map.get(colour.$colour-palette-default, \"icon-light\")};\n --keyline: #{map.get(colour.$colour-palette-default, \"keyline\")};\n --keyline-dark: #{map.get(colour.$colour-palette-default, \"keyline-dark\")};\n --button-text: #{map.get(colour.$colour-palette-default, \"button-text\")};\n --button-background: #{map.get(\n colour.$colour-palette-default,\n \"button-background\"\n )};\n --button-hover-text: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-text\"\n )};\n --button-hover-background: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-background\"\n )};\n --accent-border: var(--font-base);\n --accent-list-marker: var(--font-base);\n\n .tna-template--system-theme & {\n @media (prefers-color-scheme: dark) {\n --link: #{map.get(colour.$colour-palette-default, \"link\")};\n --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n }\n }\n\n .tna-template--dark-theme & {\n --link: #{map.get(colour.$colour-palette-default, \"link\")};\n --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n }\n\n @include colour-background(\"background\");\n @include colour-font(\"font-base\");\n}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n// Remove accent and contrast values (except for \"form-error\")\n%plain {\n @include colour-css-vars(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n\n .tna-template--system-theme & {\n @media (prefers-color-scheme: dark) {\n @include colour-css-vars-dark(\"form-error\");\n }\n\n @media (prefers-contrast: more) and (prefers-color-scheme: dark) {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n }\n\n .tna-template--dark-theme & {\n @include colour-css-vars-dark(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n }\n\n @include colour-background(\"background\");\n}\n\n@mixin plain {\n @extend %plain;\n}\n\n%yellow-accent {\n --accent-background: #{colour.brand-colour(\"yellow\")} !important;\n --accent-background-light: #{colour.brand-colour(\"cream\")} !important;\n --accent-border: #{colour.brand-colour(\"yellow\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"brown\")} !important;\n --accent-font-base: #{colour.brand-colour(\"black\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"black\")} !important;\n --accent-font-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"black\", 0.45)} !important;\n --accent-link: #{colour.brand-colour(\"black\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"black\")} !important;\n --accent-keyline: #{colour.brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"black\", 0.8)} !important;\n --button-accent-text: #{colour.brand-colour(\"white\")} !important;\n --button-accent-background: #{colour.brand-colour(\"brown\")} !important;\n}\n\n@mixin yellow-accent {\n @extend %yellow-accent;\n}\n\n%accent-lighter-text {\n --accent-font-base: #{colour.brand-colour(\"white\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"white\")} !important;\n --accent-font-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"white\", 0.45)} !important;\n --accent-link: #{colour.brand-colour(\"white\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"white\")} !important;\n --accent-keyline: #{colour.brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"white\", 0.8)} !important;\n --button-accent-text: #{colour.brand-colour(\"white\")} !important;\n}\n\n%black-accent {\n --accent-background: #{colour.brand-colour(\"black\")} !important;\n --accent-background-light: #{colour.brand-colour(\"light-grey\")} !important;\n --accent-border: #{colour.brand-colour(\"black\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"grey\")} !important;\n --button-accent-text: #{colour.brand-colour(\"black\")} !important;\n --button-accent-background: #{colour.brand-colour(\"grey\")} !important;\n}\n\n@mixin black-accent {\n @extend %accent-lighter-text;\n @extend %black-accent;\n}\n\n%pink-accent {\n --accent-background: #{colour.brand-colour(\"maroon\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-pink\")} !important;\n --accent-border: #{colour.brand-colour(\"pink\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"pink\")} !important;\n --button-accent-background: #{colour.brand-colour(\"maroon\")} !important;\n}\n\n@mixin pink-accent {\n @extend %accent-lighter-text;\n @extend %pink-accent;\n}\n\n%orange-accent {\n --accent-background: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-orange\")} !important;\n --accent-border: #{colour.brand-colour(\"orange\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"orange\")} !important;\n --button-accent-background: #{colour.brand-colour(\"chestnut\")} !important;\n}\n\n@mixin orange-accent {\n @extend %accent-lighter-text;\n @extend %orange-accent;\n}\n\n%green-accent {\n --accent-background: #{colour.brand-colour(\"forest\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-green\")} !important;\n --accent-border: #{colour.brand-colour(\"green\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"green\")} !important;\n --button-accent-background: #{colour.brand-colour(\"forest\")} !important;\n}\n\n@mixin green-accent {\n @extend %accent-lighter-text;\n @extend %green-accent;\n}\n\n%blue-accent {\n --accent-background: #{colour.brand-colour(\"navy\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-blue\")} !important;\n --accent-border: #{colour.brand-colour(\"blue\")} !important;\n --accent-list-marker: #{colour.brand-colour(\"blue\")} !important;\n --button-accent-background: #{colour.brand-colour(\"navy\")} !important;\n}\n\n@mixin blue-accent {\n @extend %accent-lighter-text;\n @extend %blue-accent;\n}\n\n@mixin on-high-contrast {\n @media (prefers-contrast: more) {\n @content;\n }\n}\n\n@mixin on-forced-colours {\n @media (forced-colors: active) {\n @content;\n }\n}\n\n@mixin on-high-contrast-and-forced-colours {\n @include on-forced-colours {\n @content;\n }\n\n @include on-high-contrast {\n @content;\n }\n}\n","@use \"sass:math\";\n@use \"../variables/typography\";\n@use \"colour\";\n@use \"media\";\n\n@mixin font-size($font-size-px) {\n font-size: #{math.div($font-size-px, typography.$relative-1rem-px)}rem;\n}\n\n@mixin relative-font-size($font-size-px) {\n @warn \"relative-font-size() will soon be deprecated in favour of font-size().\";\n @include font-size($font-size-px);\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\n}\n\n@mixin main-font-weight-medium {\n font-weight: typography.$main-font-weight-medium;\n}\n\n@mixin main-font-weight-bold {\n font-weight: typography.$main-font-weight-bold;\n}\n\n@mixin main-font($bold: false) {\n font-family: typography.$main-font-family;\n font-style: normal;\n font-optical-sizing: auto;\n font-variation-settings: \"wdth\" 100;\n @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n}\n\n@mixin heading-font {\n font-family: typography.$heading-font-family;\n font-weight: typography.$heading-font-weight;\n}\n\n@mixin detail-font($bold: false) {\n font-family: typography.$detail-font-family;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include font-size(14);\n line-height: 1.1;\n text-transform: uppercase;\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n}\n\n@mixin heading-generator(\n $font-size-default,\n $font-size-medium,\n $font-size-small,\n $font-size-tiny,\n $line-height\n) {\n $small-and-tiny-identical: $font-size-small == $font-size-tiny;\n $medium-small-and-tiny-identical: $font-size-medium == $font-size-small and\n $small-and-tiny-identical;\n $all-identical: $font-size-default == $font-size-medium and\n $medium-small-and-tiny-identical and $small-and-tiny-identical;\n line-height: $line-height;\n @include font-size($font-size-default);\n\n @if $all-identical != true {\n @if $medium-small-and-tiny-identical != true {\n @include media.on-medium {\n @include font-size($font-size-medium);\n }\n\n @if $small-and-tiny-identical != true {\n @include media.on-small {\n @include font-size($font-size-small);\n }\n\n @include media.on-tiny {\n @include font-size($font-size-tiny);\n }\n } @else {\n @include media.on-mobile {\n @include font-size($font-size-small);\n }\n }\n } @else {\n @include media.on-smaller-than-large {\n @include font-size($font-size-medium);\n }\n }\n }\n}\n","/*\n * ------------------------------------------\n * The typefaces, sizes and spacings that are\n * defined in this file have been selected to\n * ensure 100% match with the latest National\n * Archives brand guidelines - avoid changing\n * or overwriting any of these values without\n * signing off with the Digital Services team\n * first\n * ------------------------------------------\n */\n\n$relative-1rem-px: 16; // 16px = 1rem\n\n/*\n * ------------------------------------------\n * When true, use the included font files for\n * Open Sans and Roboto Mono, rather than the\n * versions hosted by Google Fonts\n * ------------------------------------------\n */\n$use-local-fonts: false !default;\n\n$body-font-size-px: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: 1.75 !default;\n\n$interactive-text-decoration-thickness: 3.5px !default;\n\n$main-font-family-name: \"Open Sans\" !default;\n$main-font-family:\n #{$main-font-family-name},\n sans-serif;\n$main-font-weight: 400 !default;\n$main-font-weight-medium: 600 !default;\n$main-font-weight-bold: 700 !default;\n$main-font-file: \"OpenSans-Regular.ttf\" !default;\n$main-font-file-medium: \"OpenSans-SemiBold.ttf\" !default;\n$main-font-file-bold: \"OpenSans-Bold.ttf\" !default;\n\n/*\n * ------------------------------------------\n * To use Supria Sans Condensed (which is the\n * approved heading typeface for The National\n * Archives), you need to obtain a licence to\n * properly embed the CSS files with the font\n * definitions in your service - check with a\n * member of the Digital Services team on how\n * to get a licence\n * ------------------------------------------\n */\n$heading-font-family-name: \"supria-sans-condensed\" !default;\n$heading-font-family:\n #{$heading-font-family-name},\n \"Arial Narrow\",\n sans-serif;\n$heading-font-weight: 500 !default;\n\n/*\n * ------------------------------------------\n * The detail font should be a monospace font\n * and is used for chips, supertitles as well\n * as the date search component\n * ------------------------------------------\n */\n$detail-font-family-name: \"Roboto Mono\" !default;\n$detail-font-family:\n #{$detail-font-family-name},\n monospace;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n$detail-font-file: \"RobotoMono-Regular.ttf\" !default;\n$detail-font-file-bold: \"RobotoMono-Medium.ttf\" !default;\n\n$heading-xl-font-size-default: 64 !default;\n$heading-xl-font-size-medium: 48 !default;\n$heading-xl-font-size-small: 36 !default;\n$heading-xl-font-size-tiny: $heading-xl-font-size-small !default;\n$heading-xl-line-height: 1.1 !default;\n\n$heading-l-font-size-default: 36 !default;\n$heading-l-font-size-medium: 30 !default;\n$heading-l-font-size-small: 28 !default;\n$heading-l-font-size-tiny: 25 !default;\n$heading-l-line-height: 1.3 !default;\n\n$heading-m-font-size-default: 22 !default;\n$heading-m-font-size-medium: 21 !default;\n$heading-m-font-size-small: 20 !default;\n$heading-m-font-size-tiny: 19 !default;\n$heading-m-line-height: 1.6 !default;\n\n$heading-s-font-size-default: 18 !default;\n$heading-s-font-size-medium: $heading-s-font-size-default !default;\n$heading-s-font-size-small: $heading-s-font-size-default !default;\n$heading-s-font-size-tiny: $heading-s-font-size-default !default;\n$heading-s-line-height: 1.6 !default;\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\n%hide-on-print {\n @media print {\n display: none;\n }\n}\n\n@mixin hide-on-print() {\n @extend %hide-on-print;\n}\n"]}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import FeaturedRecords from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
items: { control: "object" },
|
6
|
-
classes: { control: "text" },
|
7
|
-
attributes: { control: "object" },
|
8
|
-
};
|
9
|
-
|
10
|
-
Object.keys(argTypes).forEach((argType) => {
|
11
|
-
argTypes[argType].description = macroOptions.find(
|
12
|
-
(option) => option.name === argType,
|
13
|
-
)?.description;
|
14
|
-
});
|
15
|
-
|
16
|
-
export default {
|
17
|
-
title: "Components/Featured records",
|
18
|
-
argTypes,
|
19
|
-
};
|
20
|
-
|
21
|
-
const Template = ({ items, classes, attributes }) =>
|
22
|
-
FeaturedRecords({
|
23
|
-
params: {
|
24
|
-
items,
|
25
|
-
classes,
|
26
|
-
attributes,
|
27
|
-
},
|
28
|
-
});
|
29
|
-
|
30
|
-
export const Standard = Template.bind({});
|
31
|
-
Standard.args = {
|
32
|
-
items: [
|
33
|
-
{
|
34
|
-
imageSrc: "https://picsum.photos/id/237/400/600",
|
35
|
-
imageWidth: 400,
|
36
|
-
imageHeight: 600,
|
37
|
-
collection: "TS 11/45/167",
|
38
|
-
title: "Court records relating to Robert Wedderburn’s trial",
|
39
|
-
href: "#",
|
40
|
-
date: "1819–1820",
|
41
|
-
},
|
42
|
-
{
|
43
|
-
collection: "HO 42/191",
|
44
|
-
title: "Home office letters",
|
45
|
-
href: "#",
|
46
|
-
date: "1819",
|
47
|
-
},
|
48
|
-
],
|
49
|
-
classes: "tna-featured-records--demo",
|
50
|
-
};
|
@@ -1,42 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"component": "featured-records",
|
3
|
-
"fixtures": [
|
4
|
-
{
|
5
|
-
"name": "basic featured records",
|
6
|
-
"options": {
|
7
|
-
"items": [
|
8
|
-
{
|
9
|
-
"collection": "TS 11/45/167",
|
10
|
-
"title": "Court records relating to Robert Wedderburn's trial",
|
11
|
-
"href": "#",
|
12
|
-
"date": "1819–1820"
|
13
|
-
},
|
14
|
-
{
|
15
|
-
"collection": "HO 42/191",
|
16
|
-
"title": "Home office letters",
|
17
|
-
"href": "#",
|
18
|
-
"date": "1819"
|
19
|
-
}
|
20
|
-
]
|
21
|
-
},
|
22
|
-
"html": "<ul class=\"tna-featured-records\"><li class=\"tna-featured-records__item\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">TS 11/45/167</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Court records relating to Robert Wedderburn's trial</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819–1820</dd></dl></li><li class=\"tna-featured-records__item\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">HO 42/191</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Home office letters</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819</dd></dl></li></ul>"
|
23
|
-
},
|
24
|
-
{
|
25
|
-
"name": "featured records with images",
|
26
|
-
"options": {
|
27
|
-
"items": [
|
28
|
-
{
|
29
|
-
"imageSrc": "https://beta.nationalarchives.gov.uk/media/images/wedderburn-trial.max-832x591.format-webp_i3c9pUH.webp",
|
30
|
-
"imageWidth": 576,
|
31
|
-
"imageHeight": 591,
|
32
|
-
"collection": "TS 11/45/167",
|
33
|
-
"title": "Court records relating to Robert Wedderburn's trial",
|
34
|
-
"href": "#",
|
35
|
-
"date": "1819–1820"
|
36
|
-
}
|
37
|
-
]
|
38
|
-
},
|
39
|
-
"html": "<ul class=\"tna-featured-records\"><li class=\"tna-featured-records__item\"><img src=\"https://beta.nationalarchives.gov.uk/media/images/wedderburn-trial.max-832x591.format-webp_i3c9pUH.webp\" width=\"576\" height=\"591\" class=\"tna-featured-records__image\" alt=\"\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">TS 11/45/167</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Court records relating to Robert Wedderburn's trial</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819–1820</dd></dl></li></ul>"
|
40
|
-
}
|
41
|
-
]
|
42
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
2
|
-
{%- set classes = containerClasses | join(' ') -%}
|
3
|
-
<ul class="tna-featured-records{% if classes %} {{ classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
4
|
-
{%- for item in params.items %}
|
5
|
-
<li class="tna-featured-records__item">
|
6
|
-
{%- if item.imageSrc %}
|
7
|
-
<img src="{{ item.imageSrc }}" width="{{ item.imageWidth }}" height="{{ item.imageHeight }}" class="tna-featured-records__image" alt="{{ item.imageAlt }}">
|
8
|
-
{%- endif %}
|
9
|
-
<dl class="tna-featured-records__details">
|
10
|
-
<dt class="tna-featured-records__collection-label tna-chip tna-chip--plain">From our collection</dt>
|
11
|
-
<dd class="tna-featured-records__collection-description tna-chip tna-chip--plain">{{ item.collection }}</dd>
|
12
|
-
<dt class="tna-featured-records__title-label">Title</dt>
|
13
|
-
<dd class="tna-featured-records__title-description">
|
14
|
-
<a href="{{ item.href }}">{{ item.title }}</a>
|
15
|
-
</dd>
|
16
|
-
<dt class="tna-featured-records__date-label">Date</dt>
|
17
|
-
<dd class="tna-featured-records__date-description">{{ item.date }}</dd>
|
18
|
-
</dl>
|
19
|
-
</li>
|
20
|
-
{%- endfor %}
|
21
|
-
</ul>
|
@@ -1,241 +0,0 @@
|
|
1
|
-
import Footer from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
import { within, expect } from "@storybook/test";
|
4
|
-
import Cookies from "../../lib/cookies.mjs";
|
5
|
-
|
6
|
-
const argTypes = {
|
7
|
-
meta: { control: "text" },
|
8
|
-
social: { control: "object" },
|
9
|
-
navigation: { control: "object" },
|
10
|
-
showNewsletter: { control: "boolean" },
|
11
|
-
legal: { control: "object" },
|
12
|
-
themeSelector: { control: "boolean" },
|
13
|
-
currentTheme: {
|
14
|
-
control: "inline-radio",
|
15
|
-
options: ["system", "light", "dark", ""],
|
16
|
-
},
|
17
|
-
classes: { control: "text" },
|
18
|
-
attributes: { control: "object" },
|
19
|
-
};
|
20
|
-
|
21
|
-
Object.keys(argTypes).forEach((argType) => {
|
22
|
-
argTypes[argType].description = macroOptions.find(
|
23
|
-
(option) => option.name === argType,
|
24
|
-
)?.description;
|
25
|
-
});
|
26
|
-
|
27
|
-
export default {
|
28
|
-
title: "Components/Footer",
|
29
|
-
argTypes,
|
30
|
-
};
|
31
|
-
|
32
|
-
const Template = ({
|
33
|
-
meta,
|
34
|
-
social,
|
35
|
-
navigation,
|
36
|
-
showNewsletter,
|
37
|
-
legal,
|
38
|
-
themeSelector,
|
39
|
-
currentTheme,
|
40
|
-
classes,
|
41
|
-
attributes,
|
42
|
-
}) =>
|
43
|
-
Footer({
|
44
|
-
params: {
|
45
|
-
meta,
|
46
|
-
social,
|
47
|
-
navigation,
|
48
|
-
showNewsletter,
|
49
|
-
legal,
|
50
|
-
themeSelector,
|
51
|
-
currentTheme,
|
52
|
-
classes,
|
53
|
-
attributes,
|
54
|
-
},
|
55
|
-
});
|
56
|
-
|
57
|
-
export const Standard = Template.bind({});
|
58
|
-
Standard.args = {
|
59
|
-
social: [
|
60
|
-
{
|
61
|
-
href: "https://twitter.com/UKNatArchives",
|
62
|
-
icon: "twitter",
|
63
|
-
title: "The National Archives X feed (formally known as Twitter)",
|
64
|
-
},
|
65
|
-
{
|
66
|
-
href: "https://www.youtube.com/c/TheNationalArchivesUK",
|
67
|
-
icon: "youtube",
|
68
|
-
title: "The National Archives YouTube channel",
|
69
|
-
},
|
70
|
-
{
|
71
|
-
href: "https://www.facebook.com/TheNationalArchives",
|
72
|
-
icon: "facebook",
|
73
|
-
title: "The National Archives Facebook page",
|
74
|
-
},
|
75
|
-
{
|
76
|
-
href: "https://www.flickr.com/photos/nationalarchives",
|
77
|
-
icon: "flickr",
|
78
|
-
title: "The National Archives Flickr feed",
|
79
|
-
},
|
80
|
-
{
|
81
|
-
href: "https://www.instagram.com/nationalarchivesuk/",
|
82
|
-
icon: "instagram",
|
83
|
-
title: "The National Archives Instagram feed",
|
84
|
-
},
|
85
|
-
{
|
86
|
-
href: "https://www.tiktok.com/@uknatarchives",
|
87
|
-
icon: "tiktok",
|
88
|
-
title: "The National Archives TikTok feed",
|
89
|
-
},
|
90
|
-
],
|
91
|
-
navigation: [
|
92
|
-
{
|
93
|
-
title: "Quick links",
|
94
|
-
items: [
|
95
|
-
{
|
96
|
-
text: "About us",
|
97
|
-
href: "https://www.nationalarchives.gov.uk/about/",
|
98
|
-
},
|
99
|
-
{
|
100
|
-
text: "Contact us",
|
101
|
-
href: "https://www.nationalarchives.gov.uk/contact-us/",
|
102
|
-
},
|
103
|
-
{
|
104
|
-
text: "News",
|
105
|
-
href: "https://www.nationalarchives.gov.uk/about/news/",
|
106
|
-
},
|
107
|
-
{
|
108
|
-
text: "Blog",
|
109
|
-
href: "https://blog.nationalarchives.gov.uk/",
|
110
|
-
},
|
111
|
-
{
|
112
|
-
text: "Podcasts",
|
113
|
-
href: "https://media.nationalarchives.gov.uk/index.php/category/podcasts-2/",
|
114
|
-
},
|
115
|
-
{
|
116
|
-
text: "Image library",
|
117
|
-
href: "https://images.nationalarchives.gov.uk/",
|
118
|
-
},
|
119
|
-
{
|
120
|
-
text: "Press room",
|
121
|
-
href: "https://www.nationalarchives.gov.uk/about/press-room/",
|
122
|
-
},
|
123
|
-
{
|
124
|
-
text: "Jobs",
|
125
|
-
href: "https://www.nationalarchives.gov.uk/about/jobs/",
|
126
|
-
},
|
127
|
-
{
|
128
|
-
text: "British citizenship services",
|
129
|
-
href: "https://www.nationalarchives.gov.uk/contact-us/british-citizenship-services/",
|
130
|
-
},
|
131
|
-
{
|
132
|
-
text: "Historical Manuscripts Commission",
|
133
|
-
href: "https://www.nationalarchives.gov.uk/archives-sector/our-archives-sector-role/historical-manuscripts-commission/",
|
134
|
-
},
|
135
|
-
],
|
136
|
-
},
|
137
|
-
{
|
138
|
-
title: "Other websites",
|
139
|
-
items: [
|
140
|
-
{
|
141
|
-
text: "UK Government Web Archive",
|
142
|
-
href: "https://www.nationalarchives.gov.uk/webarchive/",
|
143
|
-
},
|
144
|
-
{ text: "Legislation.gov.uk", href: "https://www.legislation.gov.uk/" },
|
145
|
-
{
|
146
|
-
text: "Find case law",
|
147
|
-
href: "https://caselaw.nationalarchives.gov.uk/",
|
148
|
-
},
|
149
|
-
{
|
150
|
-
text: "The Gazette",
|
151
|
-
href: "https://www.thegazette.co.uk/",
|
152
|
-
},
|
153
|
-
{
|
154
|
-
text: "The National Archives Trust",
|
155
|
-
href: "https://www.nationalarchivestrust.org.uk/",
|
156
|
-
},
|
157
|
-
{
|
158
|
-
text: "Friends of The National Archives",
|
159
|
-
href: "https://ftna.org.uk/",
|
160
|
-
},
|
161
|
-
],
|
162
|
-
},
|
163
|
-
],
|
164
|
-
showNewsletter: true,
|
165
|
-
legal: [
|
166
|
-
{
|
167
|
-
text: "Accessibility statement",
|
168
|
-
href: "#/accessibility",
|
169
|
-
},
|
170
|
-
{
|
171
|
-
text: "Freedom of information",
|
172
|
-
href: "#/freedom-of-information",
|
173
|
-
},
|
174
|
-
{
|
175
|
-
text: "Terms and conditions",
|
176
|
-
href: "#/terms-and-conditions",
|
177
|
-
},
|
178
|
-
{
|
179
|
-
text: "Privacy policy",
|
180
|
-
href: "#/privacy",
|
181
|
-
},
|
182
|
-
{
|
183
|
-
text: "Cookies",
|
184
|
-
href: "#/cookies",
|
185
|
-
},
|
186
|
-
],
|
187
|
-
};
|
188
|
-
|
189
|
-
export const Minimal = Template.bind({});
|
190
|
-
Minimal.args = {};
|
191
|
-
|
192
|
-
export const ThemeSelector = Template.bind({});
|
193
|
-
ThemeSelector.args = {
|
194
|
-
themeSelector: true,
|
195
|
-
currentTheme: "",
|
196
|
-
};
|
197
|
-
ThemeSelector.decorators = [
|
198
|
-
(Story) => {
|
199
|
-
const cookies = new Cookies({ newInstance: true });
|
200
|
-
cookies.set("cookie_preferences_set", true);
|
201
|
-
cookies.acceptPolicy("settings");
|
202
|
-
return Story();
|
203
|
-
},
|
204
|
-
];
|
205
|
-
ThemeSelector.play = async ({ canvasElement }) => {
|
206
|
-
const canvas = within(canvasElement);
|
207
|
-
const systemLightButton = canvas.getByText("System theme");
|
208
|
-
const themeLightButton = canvas.getByText("Light theme");
|
209
|
-
const darkLightButton = canvas.getByText("Dark theme");
|
210
|
-
|
211
|
-
await expect(systemLightButton).toBeVisible();
|
212
|
-
await expect(themeLightButton).toBeVisible();
|
213
|
-
await expect(darkLightButton).toBeVisible();
|
214
|
-
};
|
215
|
-
|
216
|
-
export const ThemeSelectorWithoutCookies = Template.bind({});
|
217
|
-
ThemeSelectorWithoutCookies.parameters = {
|
218
|
-
chromatic: { disableSnapshot: true },
|
219
|
-
};
|
220
|
-
ThemeSelectorWithoutCookies.args = {
|
221
|
-
themeSelector: true,
|
222
|
-
currentTheme: "",
|
223
|
-
};
|
224
|
-
ThemeSelectorWithoutCookies.decorators = [
|
225
|
-
(Story) => {
|
226
|
-
const cookies = new Cookies({ newInstance: true });
|
227
|
-
cookies.set("cookie_preferences_set", true);
|
228
|
-
cookies.rejectPolicy("settings");
|
229
|
-
return Story();
|
230
|
-
},
|
231
|
-
];
|
232
|
-
ThemeSelectorWithoutCookies.play = async ({ canvasElement }) => {
|
233
|
-
const canvas = within(canvasElement);
|
234
|
-
const systemLightButton = canvas.getByText("System theme");
|
235
|
-
const themeLightButton = canvas.getByText("Light theme");
|
236
|
-
const darkLightButton = canvas.getByText("Dark theme");
|
237
|
-
|
238
|
-
await expect(systemLightButton).not.toBeVisible();
|
239
|
-
await expect(themeLightButton).not.toBeVisible();
|
240
|
-
await expect(darkLightButton).not.toBeVisible();
|
241
|
-
};
|