@nationalarchives/frontend 0.1.14-prerelease → 0.1.16-prerelease
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +21 -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 +7 -7
- package/nationalarchives/all.scss +2 -5
- package/nationalarchives/components/_index.scss +1 -0
- package/nationalarchives/components/breadcrumbs/_index.scss +54 -39
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +2 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +67 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +10 -3
- package/nationalarchives/components/breadcrumbs/fixtures.json +23 -1
- package/nationalarchives/components/breadcrumbs/macro-options.json +6 -0
- package/nationalarchives/components/breadcrumbs/template.njk +17 -12
- package/nationalarchives/components/button/_index.scss +1 -2
- package/nationalarchives/components/button/button.stories.js +2 -3
- package/nationalarchives/components/button/fixtures.json +5 -5
- package/nationalarchives/components/button/template.njk +1 -1
- package/nationalarchives/components/card/_index.scss +78 -34
- package/nationalarchives/components/card/card.stories.js +72 -5
- package/nationalarchives/components/card/fixtures.json +15 -2
- package/nationalarchives/components/card/macro-options.json +6 -12
- package/nationalarchives/components/card/template.njk +6 -6
- package/nationalarchives/components/filters/filters.stories.js +3 -4
- package/nationalarchives/components/footer/_index.scss +8 -14
- package/nationalarchives/components/footer/footer.stories.js +2 -3
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/grid/_index.scss +2 -2
- package/nationalarchives/components/grid/grid.stories.js +2 -3
- package/nationalarchives/components/header/_index.scss +27 -26
- package/nationalarchives/components/header/header.stories.js +2 -3
- package/nationalarchives/components/header/template.njk +1 -1
- package/nationalarchives/components/hero/_index.scss +7 -20
- package/nationalarchives/components/hero/hero.stories.js +2 -3
- package/nationalarchives/components/index-grid/_index.scss +17 -1
- package/nationalarchives/components/index-grid/index-grid.stories.js +7 -5
- package/nationalarchives/components/index-grid/macro-options.json +22 -2
- package/nationalarchives/components/index-grid/template.njk +12 -6
- package/nationalarchives/components/message/_index.scss +4 -6
- package/nationalarchives/components/message/phase-banner.stories.js +2 -3
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +2 -3
- package/nationalarchives/components/picture/_index.scss +12 -15
- package/nationalarchives/components/picture/picture.stories.js +2 -3
- package/nationalarchives/components/profile/profile.stories.js +2 -3
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -4
- package/nationalarchives/components/skip-link/_index.scss +63 -0
- package/nationalarchives/components/skip-link/fixtures.json +11 -0
- package/nationalarchives/components/skip-link/macro-options.json +26 -0
- package/nationalarchives/components/skip-link/macro.njk +3 -0
- package/nationalarchives/components/skip-link/skip-link.stories.js +31 -0
- package/nationalarchives/components/skip-link/template.njk +4 -0
- package/nationalarchives/components/tabs/_index.scss +7 -14
- package/nationalarchives/components/tabs/tabs.stories.js +2 -3
- package/nationalarchives/patterns/featured-collection/_index.scss +2 -2
- package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +3 -4
- package/nationalarchives/patterns/featured-collection/template.njk +2 -2
- package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.mdx +85 -0
- package/nationalarchives/stories/utilities/{colour.stories.js → colour-schemes/colour-schemes.stories.js} +142 -52
- package/nationalarchives/stories/utilities/overrides/overrides.mdx +66 -0
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +30 -0
- package/nationalarchives/stories/utilities/{headings.stories.js → typography/headings.stories.js} +2 -1
- package/nationalarchives/stories/utilities/typography/typography.stories.js +34 -0
- package/nationalarchives/templates/layouts/_generic.njk +10 -8
- package/nationalarchives/tools/_colour.scss +105 -16
- package/nationalarchives/tools/_index.scss +0 -1
- package/nationalarchives/tools/_typography.scss +13 -1
- package/nationalarchives/utilities/_debug.scss +41 -1
- package/nationalarchives/utilities/_global.scss +13 -4
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_overrides.scss +30 -0
- package/nationalarchives/utilities/_typography.scss +42 -34
- package/nationalarchives/variables/_colour.scss +103 -106
- package/nationalarchives/variables/_grid.scss +1 -1
- package/nationalarchives/variables/_index.scss +1 -1
- package/nationalarchives/variables/_media.scss +23 -23
- package/nationalarchives/variables/_spacing.scss +15 -0
- package/nationalarchives/variables/_typography.scss +2 -1
- package/package.json +2 -2
- package/nationalarchives/components/card/card.js +0 -2
- package/nationalarchives/components/card/card.js.map +0 -1
- package/nationalarchives/components/card/card.mjs +0 -45
- package/nationalarchives/stories/utilities/typography.stories.js +0 -29
- package/nationalarchives/tools/_assets.scss +0 -5
- package/nationalarchives/variables/_assets.scss +0 -1
- /package/nationalarchives/stories/utilities/{heading-groups.stories.js → typography/heading-groups.stories.js} +0 -0
- /package/nationalarchives/stories/utilities/{lists.stories.js → typography/lists.stories.js} +0 -0
- /package/nationalarchives/stories/utilities/{typography.mdx → typography/typography.mdx} +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"name": "text",
|
4
|
+
"type": "string",
|
5
|
+
"required": false,
|
6
|
+
"description": ""
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"name": "href",
|
10
|
+
"type": "string",
|
11
|
+
"required": false,
|
12
|
+
"description": ""
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"name": "classes",
|
16
|
+
"type": "string",
|
17
|
+
"required": false,
|
18
|
+
"description": "Classes to add to the skip link."
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"name": "attributes",
|
22
|
+
"type": "object",
|
23
|
+
"required": false,
|
24
|
+
"description": "HTML attributes (for example data attributes) to add to the skip link."
|
25
|
+
}
|
26
|
+
]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import SkipLink from "./template.njk";
|
2
|
+
import macroOptions from "./macro-options.json";
|
3
|
+
|
4
|
+
const argTypes = {
|
5
|
+
classes: { control: "text" },
|
6
|
+
attributes: { control: "object" },
|
7
|
+
};
|
8
|
+
|
9
|
+
Object.keys(argTypes).forEach((argType) => {
|
10
|
+
argTypes[argType].description = macroOptions.find(
|
11
|
+
(option) => option.name === argType,
|
12
|
+
)?.description;
|
13
|
+
});
|
14
|
+
|
15
|
+
export default {
|
16
|
+
title: "Components/Skip link",
|
17
|
+
argTypes,
|
18
|
+
};
|
19
|
+
|
20
|
+
const Template = ({ classes, attributes }) =>
|
21
|
+
`${SkipLink({
|
22
|
+
params: {
|
23
|
+
classes,
|
24
|
+
attributes,
|
25
|
+
},
|
26
|
+
})}<p>To view the skip link component tab to this example, or click inside this example and press tab.</p>`;
|
27
|
+
|
28
|
+
export const Standard = Template.bind({});
|
29
|
+
Standard.args = {
|
30
|
+
classes: "tna-skip-link--demo",
|
31
|
+
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
2
|
+
<a href="#{{ params.href if params.href else 'main-content' }}" class="tna-skip-link {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
3
|
+
{{ params.text if params.text else 'Skip to main content' }}
|
4
|
+
</a>
|
@@ -1,7 +1,11 @@
|
|
1
1
|
@use "../../tools/colour";
|
2
2
|
|
3
3
|
.tna-tabs {
|
4
|
-
margin-bottom:
|
4
|
+
margin-bottom: 2rem;
|
5
|
+
|
6
|
+
&:last-child {
|
7
|
+
margin-bottom: 0;
|
8
|
+
}
|
5
9
|
|
6
10
|
&__list {
|
7
11
|
margin: 0 0 1rem;
|
@@ -124,25 +128,14 @@
|
|
124
128
|
}
|
125
129
|
}
|
126
130
|
|
127
|
-
@
|
131
|
+
@include colour.on-high-contrast {
|
128
132
|
&__list-item-link {
|
129
133
|
padding-right: 1rem;
|
130
134
|
padding-left: 1rem;
|
131
135
|
|
132
136
|
overflow: hidden;
|
133
137
|
|
134
|
-
border
|
135
|
-
@include colour.colour-border("keyline-dark");
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
.tna-template--high-contrast-theme & {
|
140
|
-
@include high-contrast;
|
141
|
-
}
|
142
|
-
|
143
|
-
@media (prefers-contrast: more) {
|
144
|
-
.tna-template--system-theme & {
|
145
|
-
@include high-contrast;
|
138
|
+
@include colour.colour-border("keyline-dark", 1px);
|
146
139
|
}
|
147
140
|
}
|
148
141
|
}
|
@@ -22,8 +22,8 @@ export default {
|
|
22
22
|
argTypes,
|
23
23
|
};
|
24
24
|
|
25
|
-
const Template = ({ title, items, sticky, classes, attributes }) =>
|
26
|
-
|
25
|
+
const Template = ({ title, items, sticky, classes, attributes }) =>
|
26
|
+
Tabs({
|
27
27
|
params: {
|
28
28
|
title,
|
29
29
|
items,
|
@@ -32,7 +32,6 @@ const Template = ({ title, items, sticky, classes, attributes }) => {
|
|
32
32
|
attributes,
|
33
33
|
},
|
34
34
|
});
|
35
|
-
};
|
36
35
|
|
37
36
|
export const Standard = Template.bind({});
|
38
37
|
Standard.args = {
|
@@ -1,10 +1,10 @@
|
|
1
|
-
@use "../../
|
1
|
+
@use "../../tools/colour";
|
2
2
|
|
3
3
|
.tna-featured-collection {
|
4
4
|
padding-top: 2rem;
|
5
5
|
padding-bottom: 2rem;
|
6
6
|
|
7
|
-
background-color:
|
7
|
+
background-color: colour.brand-colour("cream");
|
8
8
|
|
9
9
|
.tna-card {
|
10
10
|
margin-top: 1rem;
|
@@ -14,19 +14,18 @@ Object.keys(argTypes).forEach((argType) => {
|
|
14
14
|
});
|
15
15
|
|
16
16
|
export default {
|
17
|
-
title: "Experimental/
|
17
|
+
title: "Patterns/Experimental/Featured collection",
|
18
18
|
argTypes,
|
19
19
|
};
|
20
20
|
|
21
|
-
const Template = ({ heading, classes, attributes }) =>
|
22
|
-
|
21
|
+
const Template = ({ heading, classes, attributes }) =>
|
22
|
+
FeaturedCollection({
|
23
23
|
params: {
|
24
24
|
heading,
|
25
25
|
classes,
|
26
26
|
attributes,
|
27
27
|
},
|
28
28
|
});
|
29
|
-
};
|
30
29
|
|
31
30
|
export const Standard = Template.bind({});
|
32
31
|
Standard.args = {
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { Meta, Canvas } from "@storybook/blocks";
|
2
|
+
import * as ColourStories from './colour-schemes.stories';
|
3
|
+
|
4
|
+
<Meta of={ColourStories} />
|
5
|
+
|
6
|
+
# Colour schemes
|
7
|
+
|
8
|
+
## System theme
|
9
|
+
|
10
|
+
The system theme follows the operating system preference for `prefers-color-scheme` which can either be `light` or `dark`.
|
11
|
+
|
12
|
+
The system theme also follows the preference for `prefers-contrast` which can be `no-preference`, `more`, `less` or `custom`.
|
13
|
+
|
14
|
+
At this time, only `prefers-contrast: no-preference` and `prefers-contrast: more` are supported.
|
15
|
+
|
16
|
+
- [MDN Web Docs - prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
|
17
|
+
- [MDN Web Docs - prefers-contrast](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-contrast)
|
18
|
+
|
19
|
+
```html
|
20
|
+
<html class="tna-template tna-template--system-theme">
|
21
|
+
<head>
|
22
|
+
<title>System theme</title>
|
23
|
+
</head>
|
24
|
+
<body class="tna-template__body">
|
25
|
+
</body>
|
26
|
+
</html>
|
27
|
+
```
|
28
|
+
|
29
|
+
## Light theme
|
30
|
+
|
31
|
+
```html
|
32
|
+
<html class="tna-template tna-template--light-theme">
|
33
|
+
<head>
|
34
|
+
<title>Light theme</title>
|
35
|
+
</head>
|
36
|
+
<body class="tna-template__body">
|
37
|
+
</body>
|
38
|
+
</html>
|
39
|
+
```
|
40
|
+
|
41
|
+
## Dark theme
|
42
|
+
|
43
|
+
```html
|
44
|
+
<html class="tna-template tna-template--dark-theme">
|
45
|
+
<head>
|
46
|
+
<title>Dark theme</title>
|
47
|
+
</head>
|
48
|
+
<body class="tna-template__body">
|
49
|
+
</body>
|
50
|
+
</html>
|
51
|
+
```
|
52
|
+
|
53
|
+
## High contrast themes
|
54
|
+
|
55
|
+
The high contrast themes are applied on top of the existing light and dark themes with an extra `tna-template--high-contrast-theme` class on the `tna-template` element.
|
56
|
+
|
57
|
+
### Light, high contrast theme
|
58
|
+
|
59
|
+
```html
|
60
|
+
<html class="tna-template tna-template--light-theme tna-template--high-contrast-theme">
|
61
|
+
<head>
|
62
|
+
<title>Light, high contrast theme</title>
|
63
|
+
</head>
|
64
|
+
<body class="tna-template__body">
|
65
|
+
</body>
|
66
|
+
</html>
|
67
|
+
```
|
68
|
+
|
69
|
+
### Dark, high contrast theme
|
70
|
+
|
71
|
+
```html
|
72
|
+
<html class="tna-template tna-template--dark-theme tna-template--high-contrast-theme">
|
73
|
+
<head>
|
74
|
+
<title>Dark, high contrast theme</title>
|
75
|
+
</head>
|
76
|
+
<body class="tna-template__body">
|
77
|
+
</body>
|
78
|
+
</html>
|
79
|
+
```
|
80
|
+
|
81
|
+
## Colour definitions
|
82
|
+
|
83
|
+
The colours are defined in `src/nationalarchives/variables/_colour.scss` as a separate map for each theme.
|
84
|
+
|
85
|
+
This allows you to reference a colour, such as `font-base` without having to worry about which theme is currently in use.
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
1
|
+
import SkipLink from "../../../components/skip-link/template.njk";
|
2
|
+
import Header from "../../../components/header/template.njk";
|
3
|
+
import Breadcrumbs from "../../../components/breadcrumbs/template.njk";
|
4
|
+
import Card from "../../../components/card/template.njk";
|
5
|
+
import Hero from "../../../components/hero/template.njk";
|
6
|
+
import IndexGrid from "../../../components/index-grid/template.njk";
|
7
|
+
import Message from "../../../components/message/template.njk";
|
8
|
+
import Picture from "../../../components/picture/template.njk";
|
9
|
+
import Tabs from "../../../components/tabs/template.njk";
|
10
|
+
import Footer from "../../../components/footer/template.njk";
|
11
11
|
|
12
12
|
const argTypes = {
|
13
13
|
theme: {
|
@@ -23,15 +23,11 @@ const argTypes = {
|
|
23
23
|
};
|
24
24
|
|
25
25
|
export default {
|
26
|
-
title: "
|
26
|
+
title: "Utilities/Colour schemes",
|
27
27
|
argTypes,
|
28
28
|
};
|
29
29
|
|
30
30
|
const Template = ({ theme }) => {
|
31
|
-
if (supportDynamicColourSchemes) {
|
32
|
-
// document.documentElement.classList.remove("tna-template--light-theme");
|
33
|
-
// document.documentElement.classList.add("tna-template--system-theme");
|
34
|
-
}
|
35
31
|
return `<div class="tna-template ${
|
36
32
|
theme === "system"
|
37
33
|
? "tna-template--system-theme"
|
@@ -46,8 +42,17 @@ const Template = ({ theme }) => {
|
|
46
42
|
: ""
|
47
43
|
}">
|
48
44
|
<div class="tna-template__body tna-template__body--padded">
|
45
|
+
${SkipLink({
|
46
|
+
params: {
|
47
|
+
href: "main-content",
|
48
|
+
},
|
49
|
+
})}
|
49
50
|
${Header({
|
50
51
|
params: {
|
52
|
+
logo: {
|
53
|
+
strapline: "Colours",
|
54
|
+
href: "#/",
|
55
|
+
},
|
51
56
|
navigation: [
|
52
57
|
{
|
53
58
|
text: "Alpha",
|
@@ -92,7 +97,7 @@ const Template = ({ theme }) => {
|
|
92
97
|
],
|
93
98
|
},
|
94
99
|
})}
|
95
|
-
<
|
100
|
+
<main id="main-content" role="main">
|
96
101
|
${Hero({
|
97
102
|
params: {
|
98
103
|
heading: "Title",
|
@@ -111,7 +116,6 @@ const Template = ({ theme }) => {
|
|
111
116
|
<p class="tna-hgroup__supertitle">TNA colour theme</p>
|
112
117
|
<h2 class="tna-hgroup__title">Heading</h2>
|
113
118
|
</hgroup>
|
114
|
-
<hr>
|
115
119
|
<p class="tna-p">Lorem ipsum <a href="#">link</a></p>
|
116
120
|
<ul class="tna-ul">
|
117
121
|
<li>Alpha</li>
|
@@ -120,13 +124,33 @@ const Template = ({ theme }) => {
|
|
120
124
|
</ul>
|
121
125
|
<a href="#" class="tna-button">Primary button</a>
|
122
126
|
<a href="#" class="tna-button tna-button--secondary">Secondary button</a>
|
123
|
-
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<hr>
|
130
|
+
<div class="tna-container">
|
131
|
+
<div class="tna-column tna-column--full">
|
132
|
+
<p class="tna-!--no-margin-bottom">Lorem ipsum</p>
|
133
|
+
<p class="tna-!--no-margin-bottom tna-!__padding-top--xs">Lorem ipsum</p>
|
134
|
+
<p class="tna-!--no-margin-bottom tna-!__padding-top--s">Lorem ipsum</p>
|
135
|
+
<p class="tna-!--no-margin-bottom tna-!__padding-top--m">Lorem ipsum</p>
|
136
|
+
<p class="tna-!--no-margin-bottom tna-!__padding-top--l">Lorem ipsum</p>
|
137
|
+
<p class="tna-!--no-margin-bottom tna-!__padding-top--xl">Lorem ipsum</p>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
<hr>
|
141
|
+
<div class="tna-container">
|
142
|
+
<div class="tna-column tna-column--full">
|
124
143
|
${Message({
|
125
144
|
params: {
|
126
145
|
message:
|
127
146
|
"Please note this page references hunger strikes and force feeding, which some people may find upsetting.",
|
128
147
|
},
|
129
148
|
})}
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
<hr>
|
152
|
+
<div class="tna-container">
|
153
|
+
<div class="tna-column tna-column--full">
|
130
154
|
${Card({
|
131
155
|
params: {
|
132
156
|
heading: {
|
@@ -143,10 +167,50 @@ const Template = ({ theme }) => {
|
|
143
167
|
width: 1996,
|
144
168
|
height: 1331,
|
145
169
|
},
|
170
|
+
label: "New",
|
146
171
|
body: "<p>Card body</p>",
|
147
172
|
classes: "tna-card--demo",
|
148
173
|
},
|
149
174
|
})}
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
<hr>
|
178
|
+
<div class="tna-container">
|
179
|
+
<div class="tna-column tna-column--full">
|
180
|
+
${Card({
|
181
|
+
params: {
|
182
|
+
heading: {
|
183
|
+
supertitle: "Card supertitle",
|
184
|
+
title: "Card title",
|
185
|
+
level: 3,
|
186
|
+
size: "l",
|
187
|
+
singleSentence: false,
|
188
|
+
},
|
189
|
+
href: "#",
|
190
|
+
image: {
|
191
|
+
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
192
|
+
alt: "The National Archives office",
|
193
|
+
width: 1996,
|
194
|
+
height: 1331,
|
195
|
+
},
|
196
|
+
label: "New",
|
197
|
+
body: "<p>Card body</p>",
|
198
|
+
actions: [
|
199
|
+
{
|
200
|
+
text: "Card action",
|
201
|
+
href: "#",
|
202
|
+
title: "Go and do the action",
|
203
|
+
},
|
204
|
+
],
|
205
|
+
featured: true,
|
206
|
+
classes: "tna-card--demo",
|
207
|
+
},
|
208
|
+
})}
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
<hr>
|
212
|
+
<div class="tna-container">
|
213
|
+
<div class="tna-column tna-column--full">
|
150
214
|
${Tabs({
|
151
215
|
params: {
|
152
216
|
title: "Example tabs",
|
@@ -170,6 +234,11 @@ const Template = ({ theme }) => {
|
|
170
234
|
classes: "tna-tabs--demo",
|
171
235
|
},
|
172
236
|
})}
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
<hr>
|
240
|
+
<div class="tna-container">
|
241
|
+
<div class="tna-column tna-column--full">
|
173
242
|
${Picture({
|
174
243
|
params: {
|
175
244
|
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
@@ -182,46 +251,67 @@ const Template = ({ theme }) => {
|
|
182
251
|
classes: "tna-picture--demo",
|
183
252
|
},
|
184
253
|
})}
|
185
|
-
${IndexGrid({
|
186
|
-
params: {
|
187
|
-
heading: "My dogs",
|
188
|
-
items: Array(12)
|
189
|
-
.fill({
|
190
|
-
...{
|
191
|
-
href: "#",
|
192
|
-
src: "https://picsum.photos/id/237/800/600",
|
193
|
-
alt: "Photo of a puppy",
|
194
|
-
width: "800",
|
195
|
-
height: "600",
|
196
|
-
title: "Cat",
|
197
|
-
subtitle: "4 photos",
|
198
|
-
},
|
199
|
-
})
|
200
|
-
.map((item, index) => {
|
201
|
-
const pseudoRandom = ((index * 29) % 8) + 1;
|
202
|
-
return {
|
203
|
-
...item,
|
204
|
-
href: `#/category-${index}`,
|
205
|
-
title: `Category #${index + 101}`,
|
206
|
-
subtitle: `${pseudoRandom} photos`,
|
207
|
-
};
|
208
|
-
}),
|
209
|
-
columns: 4,
|
210
|
-
columnsMedium: 3,
|
211
|
-
columnsSmall: 2,
|
212
|
-
columnsTiny: 1,
|
213
|
-
},
|
214
|
-
})}
|
215
254
|
</div>
|
216
255
|
</div>
|
217
|
-
|
256
|
+
<hr>
|
257
|
+
${IndexGrid({
|
258
|
+
params: {
|
259
|
+
heading: "My dogs",
|
260
|
+
items: Array(12)
|
261
|
+
.fill({
|
262
|
+
...{
|
263
|
+
href: "#",
|
264
|
+
src: "https://picsum.photos/id/237/800/600",
|
265
|
+
alt: "Photo of a puppy",
|
266
|
+
width: "800",
|
267
|
+
height: "600",
|
268
|
+
title: "Cat",
|
269
|
+
subtitle: "4 photos",
|
270
|
+
},
|
271
|
+
})
|
272
|
+
.map((item, index) => {
|
273
|
+
const pseudoRandom = ((index * 29) % 8) + 1;
|
274
|
+
return {
|
275
|
+
...item,
|
276
|
+
href: `#/category-${index}`,
|
277
|
+
title: `Category #${index + 101}`,
|
278
|
+
subtitle: `${pseudoRandom} photos`,
|
279
|
+
};
|
280
|
+
}),
|
281
|
+
columns: 4,
|
282
|
+
columnsMedium: 3,
|
283
|
+
columnsSmall: 2,
|
284
|
+
columnsTiny: 1,
|
285
|
+
},
|
286
|
+
})}
|
287
|
+
</main>
|
218
288
|
${Footer({})}
|
219
289
|
</div>
|
220
290
|
</div>`;
|
221
291
|
};
|
222
292
|
|
223
|
-
export const
|
224
|
-
//
|
225
|
-
|
293
|
+
export const System = Template.bind({});
|
294
|
+
// System.parameters = { options: { showPanel: false } };
|
295
|
+
System.args = {
|
296
|
+
theme: "system",
|
297
|
+
};
|
298
|
+
|
299
|
+
export const Light = Template.bind({});
|
300
|
+
Light.args = {
|
226
301
|
theme: "light",
|
227
302
|
};
|
303
|
+
|
304
|
+
export const Dark = Template.bind({});
|
305
|
+
Dark.args = {
|
306
|
+
theme: "dark",
|
307
|
+
};
|
308
|
+
|
309
|
+
export const LightHighContrast = Template.bind({});
|
310
|
+
LightHighContrast.args = {
|
311
|
+
theme: "light high-contrast",
|
312
|
+
};
|
313
|
+
|
314
|
+
export const DarkHighContrast = Template.bind({});
|
315
|
+
DarkHighContrast.args = {
|
316
|
+
theme: "dark high-contrast",
|
317
|
+
};
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { Meta, Canvas } from "@storybook/blocks";
|
2
|
+
import * as OverrideStories from './overrides.stories';
|
3
|
+
|
4
|
+
<Meta of={OverrideStories} />
|
5
|
+
|
6
|
+
# Overrides
|
7
|
+
|
8
|
+
## Margin
|
9
|
+
|
10
|
+
### Top
|
11
|
+
|
12
|
+
- `tna-!--no-margin-top`
|
13
|
+
- `tna-!--margin-top-xs`
|
14
|
+
- `tna-!--margin-top-s`
|
15
|
+
- `tna-!--margin-top-m`
|
16
|
+
- `tna-!--margin-top-l`
|
17
|
+
- `tna-!--margin-top-xl`
|
18
|
+
|
19
|
+
### Bottom
|
20
|
+
|
21
|
+
- `tna-!--no-margin-bottom`
|
22
|
+
- `tna-!--margin-bottom-xs`
|
23
|
+
- `tna-!--margin-bottom-s`
|
24
|
+
- `tna-!--margin-bottom-m`
|
25
|
+
- `tna-!--margin-bottom-l`
|
26
|
+
- `tna-!--margin-bottom-xl`
|
27
|
+
|
28
|
+
### Vertical (top and bottom)
|
29
|
+
|
30
|
+
- `tna-!--no-margin-vertical`
|
31
|
+
- `tna-!--margin-vertical-xs`
|
32
|
+
- `tna-!--margin-vertical-s`
|
33
|
+
- `tna-!--margin-vertical-m`
|
34
|
+
- `tna-!--margin-vertical-l`
|
35
|
+
- `tna-!--margin-vertical-xl`
|
36
|
+
|
37
|
+
## Padding
|
38
|
+
|
39
|
+
### Top
|
40
|
+
|
41
|
+
- `tna-!--no-padding-top`
|
42
|
+
- `tna-!--padding-top-xs`
|
43
|
+
- `tna-!--padding-top-s`
|
44
|
+
- `tna-!--padding-top-m`
|
45
|
+
- `tna-!--padding-top-l`
|
46
|
+
- `tna-!--padding-top-xl`
|
47
|
+
|
48
|
+
### Bottom
|
49
|
+
|
50
|
+
- `tna-!--no-padding-bottom`
|
51
|
+
- `tna-!--padding-bottom-xs`
|
52
|
+
- `tna-!--padding-bottom-s`
|
53
|
+
- `tna-!--padding-bottom-m`
|
54
|
+
- `tna-!--padding-bottom-l`
|
55
|
+
- `tna-!--padding-bottom-xl`
|
56
|
+
|
57
|
+
### Vertical (top and bottom)
|
58
|
+
|
59
|
+
- `tna-!--no-padding-vertical`
|
60
|
+
- `tna-!--padding-vertical-xs`
|
61
|
+
- `tna-!--padding-vertical-s`
|
62
|
+
- `tna-!--padding-vertical-m`
|
63
|
+
- `tna-!--padding-vertical-l`
|
64
|
+
- `tna-!--padding-vertical-xl`
|
65
|
+
|
66
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
const argTypes = {
|
2
|
+
marginTop: {
|
3
|
+
control: "radio",
|
4
|
+
options: ["none", "xs", "s", "m", "l", "xl"],
|
5
|
+
},
|
6
|
+
};
|
7
|
+
|
8
|
+
export default {
|
9
|
+
title: "Utilities/Overrides",
|
10
|
+
argTypes,
|
11
|
+
};
|
12
|
+
|
13
|
+
const Template = ({ marginTop }) => {
|
14
|
+
const marginClass =
|
15
|
+
marginTop === "none"
|
16
|
+
? `tna-!--no-margin-top`
|
17
|
+
: `tna-!--margin-top-${marginTop}`;
|
18
|
+
return `<p class="tna-!--margin-bottom-xl">Lorem ipsum (tna-!--margin-bottom-xl)</p>
|
19
|
+
<p class="tna-!--margin-bottom-l">Lorem ipsum (tna-!--margin-bottom-l)</p>
|
20
|
+
<p class="tna-!--margin-bottom-m">Lorem ipsum (tna-!--margin-bottom-m)</p>
|
21
|
+
<p class="tna-!--margin-bottom-s">Lorem ipsum (tna-!--margin-bottom-s)</p>
|
22
|
+
<p class="tna-!--margin-bottom-xs">Lorem ipsum (tna-!--margin-bottom-xs)</p>
|
23
|
+
<p class="tna-!--no-margin-bottom">Lorem ipsum (tna-!--no-margin-bottom)</p>
|
24
|
+
<p class="${marginClass}">Lorem ipsum (${marginClass})</p>`;
|
25
|
+
};
|
26
|
+
|
27
|
+
export const Margin = Template.bind({});
|
28
|
+
Margin.args = {
|
29
|
+
marginTop: "none",
|
30
|
+
};
|
package/nationalarchives/stories/utilities/{headings.stories.js → typography/headings.stories.js}
RENAMED
@@ -12,7 +12,8 @@ const HeadingTemplate = ({ params }, level) => `<h${level} class="tna-heading${
|
|
12
12
|
params.size ? ` tna-heading--${params.size}` : ""
|
13
13
|
}">
|
14
14
|
${params.text} (${params.size.toUpperCase()})
|
15
|
-
</h${level}
|
15
|
+
</h${level}>
|
16
|
+
`;
|
16
17
|
|
17
18
|
const HeadingsTemplate = ({ text }) =>
|
18
19
|
`${HeadingTemplate({ params: { text, size: "xl" } }, 1)}${HeadingTemplate(
|
@@ -0,0 +1,34 @@
|
|
1
|
+
const argTypes = {
|
2
|
+
text: { control: "text" },
|
3
|
+
};
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: "Utilities/Typography",
|
7
|
+
argTypes,
|
8
|
+
};
|
9
|
+
|
10
|
+
const ParagraphTemplate = ({ paragraphs }) =>
|
11
|
+
paragraphs.map((paragraph) => `<p class="tna-p">${paragraph}</p>`).join("");
|
12
|
+
export const Paragraph = ParagraphTemplate.bind({});
|
13
|
+
Paragraph.args = {
|
14
|
+
paragraphs: [
|
15
|
+
"This is some body text.",
|
16
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh. Donec ac tellus in dui rutrum maximus. Aliquam vel euismod eros. Integer ut magna velit. Fusce sed dui sit amet metus eleifend dictum quis vitae mi. Aenean sagittis euismod purus, in accumsan metus venenatis nec. Nullam nec velit felis. Sed nec felis eu nisl varius dictum eu quis nisl. Donec dapibus est arcu, vel pellentesque risus pellentesque eget.",
|
17
|
+
"Nam a posuere lectus. Vivamus facilisis est pretium augue aliquet iaculis. Phasellus ligula orci, commodo eget lectus et, tincidunt scelerisque erat. Aliquam in est vel purus ultricies vulputate non sed ligula. Pellentesque ut felis ullamcorper, eleifend erat dapibus, feugiat metus. Phasellus vitae dolor commodo, posuere nisl sed, luctus mauris. Etiam malesuada tincidunt enim, ac fermentum est pulvinar id. Maecenas id accumsan libero. Curabitur at velit nisi. Nullam gravida mauris quam, tempor pharetra risus venenatis vel. Proin quis malesuada lacus. Nulla condimentum facilisis turpis, et elementum leo. Nulla gravida quam mauris, id scelerisque est rhoncus ac.",
|
18
|
+
],
|
19
|
+
};
|
20
|
+
|
21
|
+
const BlockquoteTemplate = ({
|
22
|
+
html,
|
23
|
+
author,
|
24
|
+
}) => `<blockquote class="tna-blockquote">
|
25
|
+
<div class="tna-blockquote__quote">
|
26
|
+
${html}
|
27
|
+
</div>
|
28
|
+
<p class="tna-blockquote__author">${author}</p>
|
29
|
+
</p>`;
|
30
|
+
export const Blockquote = BlockquoteTemplate.bind({});
|
31
|
+
Blockquote.args = {
|
32
|
+
html: "<p>A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.</p>",
|
33
|
+
author: "Douglas Adams, Mostly Harmless",
|
34
|
+
};
|