@nationalarchives/frontend 0.1.5-prerelease → 0.1.7-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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/govuk-prototype-kit.config.json +16 -1
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -1
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/all.scss +4 -3
  8. package/nationalarchives/components/_all.scss +6 -7
  9. package/nationalarchives/components/breadcrumbs/_index.scss +68 -0
  10. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +57 -0
  11. package/nationalarchives/components/breadcrumbs/fixtures.json +26 -0
  12. package/nationalarchives/components/breadcrumbs/macro-options.json +40 -0
  13. package/nationalarchives/components/breadcrumbs/macro.njk +3 -0
  14. package/nationalarchives/components/breadcrumbs/template.njk +13 -0
  15. package/nationalarchives/components/button/_index.scss +10 -11
  16. package/nationalarchives/components/button/button.stories.js +2 -3
  17. package/nationalarchives/components/card/_index.scss +48 -10
  18. package/nationalarchives/components/card/card.stories.js +43 -12
  19. package/nationalarchives/components/card/fixtures.json +135 -7
  20. package/nationalarchives/components/card/macro-options.json +42 -10
  21. package/nationalarchives/components/card/template.njk +53 -24
  22. package/nationalarchives/components/footer/_index.scss +33 -23
  23. package/nationalarchives/components/footer/fixtures.json +1 -1
  24. package/nationalarchives/components/footer/footer.stories.js +23 -3
  25. package/nationalarchives/components/footer/macro-options.json +12 -0
  26. package/nationalarchives/components/footer/template.njk +16 -5
  27. package/nationalarchives/components/grid/_index.scss +123 -51
  28. package/nationalarchives/components/grid/grid.stories.js +6 -4
  29. package/nationalarchives/components/grid/macro-options.json +7 -1
  30. package/nationalarchives/components/grid/template.njk +3 -0
  31. package/nationalarchives/components/hero/_index.scss +132 -0
  32. package/nationalarchives/components/hero/fixtures.json +4 -0
  33. package/nationalarchives/components/hero/hero.stories.js +74 -0
  34. package/nationalarchives/components/hero/macro-options.json +58 -0
  35. package/nationalarchives/components/hero/macro.njk +3 -0
  36. package/nationalarchives/components/hero/template.njk +30 -0
  37. package/nationalarchives/components/sensitive-image/_index.scss +10 -17
  38. package/nationalarchives/components/sensitive-image/sensitive-image.js +1 -1
  39. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -1
  40. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +1 -1
  41. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +38 -3
  42. package/nationalarchives/stories/design/about.mdx +25 -0
  43. package/nationalarchives/stories/development/about.mdx +1 -1
  44. package/nationalarchives/stories/development/publishing.mdx +1 -0
  45. package/nationalarchives/stories/utilities/heading-groups.stories.js +44 -0
  46. package/nationalarchives/stories/{global → utilities}/headings.stories.js +1 -1
  47. package/nationalarchives/stories/utilities/lists.stories.js +38 -0
  48. package/nationalarchives/stories/{global → utilities}/typography.mdx +8 -8
  49. package/nationalarchives/stories/utilities/typography.stories.js +14 -0
  50. package/nationalarchives/templates/homepage.njk +64 -0
  51. package/nationalarchives/templates/layouts/_generic.njk +60 -0
  52. package/nationalarchives/templates/search-results.njk +38 -0
  53. package/nationalarchives/templates/topics.njk +42 -0
  54. package/nationalarchives/tools/_all.scss +3 -2
  55. package/nationalarchives/tools/_grid.scss +8 -95
  56. package/nationalarchives/tools/_media.scss +62 -0
  57. package/nationalarchives/tools/_typography.scss +6 -0
  58. package/nationalarchives/utilities/_all.scss +2 -2
  59. package/nationalarchives/utilities/_global.scss +8 -0
  60. package/nationalarchives/utilities/_typography.scss +126 -55
  61. package/nationalarchives/variables/_all.scss +4 -2
  62. package/nationalarchives/variables/_colour.scss +1 -0
  63. package/nationalarchives/variables/_grid.scss +7 -7
  64. package/nationalarchives/variables/_media.scss +11 -11
  65. package/nationalarchives/variables/_typography.scss +10 -0
  66. package/package.json +13 -5
  67. package/nationalarchives/_base.scss +0 -3
  68. package/nationalarchives/_prototype-kit.scss +0 -3
  69. package/nationalarchives/components/button/_button.scss +0 -2
  70. package/nationalarchives/components/card/_card.scss +0 -2
  71. package/nationalarchives/components/footer/_footer.scss +0 -2
  72. package/nationalarchives/components/grid/_grid.scss +0 -2
  73. package/nationalarchives/components/sensitive-image/_sensitive-image.scss +0 -2
  74. package/nationalarchives/stories/global/heading-groups.stories.js +0 -23
  75. package/nationalarchives/stories/global/typography.stories.js +0 -15
  76. package/nationalarchives/tools/_exports.scss +0 -36
@@ -1,3 +1,5 @@
1
+ @use "../variables/typography";
2
+
1
3
  .tna-template {
2
4
  min-width: 320px;
3
5
  width: 100%;
@@ -7,6 +9,8 @@
7
9
  overflow-y: auto;
8
10
  -webkit-overflow-scrolling: touch;
9
11
 
12
+ font-size: typography.$base-font-size-px;
13
+
10
14
  @media (prefers-reduced-motion) {
11
15
  * {
12
16
  animation: none !important;
@@ -37,3 +41,7 @@ video,
37
41
  canvas {
38
42
  width: 100%;
39
43
  }
44
+
45
+ *:focus {
46
+ outline: 3px #f0a solid;
47
+ }
@@ -1,82 +1,153 @@
1
+ @use "../variables/typography";
2
+ @use "../tools/typography" as tools;
3
+
1
4
  // Temporary - will eventually bundle font files into package
2
- @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=Roboto+Mono:wght@500;700&display=swap");
5
+ @import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=Roboto+Mono:wght@500;700&display=swap";
6
+ @import "https://use.typekit.net/hkj3kuz.css";
3
7
 
4
8
  .tna-template {
5
- font-family: "Open Sans", sans-serif;
6
- font-size: 16px;
9
+ font-family: typography.$font-family-main;
10
+ font-weight: typography.$font-weight-main;
7
11
  -moz-osx-font-smoothing: grayscale;
8
12
  -webkit-font-smoothing: antialiased;
9
13
  text-rendering: optimizeLegibility;
10
14
  -webkit-text-size-adjust: none;
11
15
  direction: ltr;
12
- }
13
16
 
14
- .tna-template__body {
15
- font-size: 1rem;
16
- line-height: 1.6;
17
- }
17
+ p {
18
+ margin: 0 0 2rem;
18
19
 
19
- .tna-heading {
20
- }
21
-
22
- .tna-heading--xl {
23
- font-size: 4rem;
24
- }
20
+ &:last-child {
21
+ margin-bottom: 0;
22
+ }
23
+ }
25
24
 
26
- .tna-heading--l {
27
- font-size: 2rem;
28
- }
25
+ a {
26
+ &:active {
27
+ text-decoration-thickness: 4px;
28
+ }
29
29
 
30
- .tna-heading--m {
31
- font-size: 1.3rem;
32
- }
30
+ &:hover {
31
+ text-decoration-thickness: 3px;
32
+ }
33
+ }
33
34
 
34
- .tna-heading--s {
35
- font-size: 1.125rem;
36
- }
35
+ .tna-template__body {
36
+ @include tools.relative-font-size(16);
37
+ line-height: 1.6;
38
+ }
37
39
 
38
- .tna-hgroup {
39
- }
40
+ .tna-ul,
41
+ .tna-ol {
42
+ padding-left: 2rem;
40
43
 
41
- .tna-hgroup--xl {
42
- .tna-hgroup__supertitle {
44
+ li::marker {
45
+ color: #f0a;
46
+ font-weight: 700;
47
+ }
43
48
  }
44
49
 
45
- .tna-hgroup__title {
46
- font-size: 4rem;
47
- }
48
- }
50
+ .tna-ul--plain,
51
+ .tna-ol--plain {
52
+ padding-left: 0;
49
53
 
50
- .tna-hgroup--l {
51
- .tna-hgroup__supertitle {
54
+ list-style: none;
52
55
  }
53
56
 
54
- .tna-hgroup__title {
55
- font-size: 2rem;
56
- }
57
- }
57
+ .tna-heading {
58
+ margin-top: 0;
59
+ margin-bottom: 1.5rem;
58
60
 
59
- .tna-hgroup--m {
60
- .tna-hgroup__supertitle {
61
- }
61
+ font-family: typography.$font-family-heading;
62
+ font-weight: typography.$font-weight-heading;
62
63
 
63
- .tna-hgroup__title {
64
- font-size: 1.3rem;
65
- }
66
- }
64
+ &:last-child {
65
+ margin-bottom: 0;
66
+ }
67
67
 
68
- .tna-hgroup--s {
69
- .tna-hgroup__supertitle {
70
- }
68
+ &--xl {
69
+ @include tools.relative-font-size(64);
70
+ line-height: 1;
71
+ }
71
72
 
72
- .tna-hgroup__title {
73
- font-size: 1.125rem;
74
- }
75
- }
73
+ &--l {
74
+ @include tools.relative-font-size(32);
75
+ line-height: 1.2;
76
+ }
76
77
 
77
- .tna-hgroup__supertitle {
78
- text-transform: uppercase;
79
- }
78
+ &--m {
79
+ @include tools.relative-font-size(20);
80
+ line-height: 1.4;
81
+ }
80
82
 
81
- .tna-hgroup__title {
83
+ &--s {
84
+ @include tools.relative-font-size(18);
85
+ line-height: 1.6;
86
+ }
87
+ }
88
+
89
+ .tna-hgroup {
90
+ margin-bottom: 2rem;
91
+
92
+ &:last-child {
93
+ margin-bottom: 0;
94
+ }
95
+
96
+ &__supertitle {
97
+ margin: 0;
98
+
99
+ @include tools.relative-font-size(14);
100
+ font-family: typography.$font-family-detail;
101
+ font-weight: typography.$font-weight-detail;
102
+ text-transform: uppercase;
103
+
104
+ // .tna-hgroup & {
105
+ // margin: 0;
106
+ // }
107
+ }
108
+
109
+ &__title {
110
+ margin: 0;
111
+
112
+ .tna-hgroup__supertitle {
113
+ display: block;
114
+ }
115
+ }
116
+
117
+ &--xl {
118
+ .tna-hgroup__supertitle {
119
+ }
120
+
121
+ .tna-hgroup__title {
122
+ @include tools.relative-font-size(64);
123
+ }
124
+ }
125
+
126
+ &--l {
127
+ .tna-hgroup__supertitle {
128
+ }
129
+
130
+ .tna-hgroup__title {
131
+ @include tools.relative-font-size(32);
132
+ }
133
+ }
134
+
135
+ &--m {
136
+ .tna-hgroup__supertitle {
137
+ }
138
+
139
+ .tna-hgroup__title {
140
+ @include tools.relative-font-size(20);
141
+ }
142
+ }
143
+
144
+ &--s {
145
+ .tna-hgroup__supertitle {
146
+ }
147
+
148
+ .tna-hgroup__title {
149
+ @include tools.relative-font-size(18);
150
+ }
151
+ }
152
+ }
82
153
  }
@@ -1,2 +1,4 @@
1
- @import "grid";
2
- @import "media";
1
+ @use "colour";
2
+ @use "grid";
3
+ @use "media";
4
+ @use "typography";
@@ -0,0 +1 @@
1
+ $base-font-colour: #111 !default;
@@ -1,9 +1,9 @@
1
- $largest-container-width: 75.25rem;
1
+ $largest-container-width: 75.25rem !default;
2
2
 
3
- $gutter-width: 2rem;
4
- $gutter-width-mobile: 0.75rem;
3
+ $gutter-width: 2rem !default;
4
+ $gutter-width-mobile: 0.75rem !default;
5
5
 
6
- $column-count: 12;
7
- $column-count-medium: 6;
8
- $column-count-small: 4;
9
- $column-count-tiny: 2;
6
+ $column-count: 12 !default;
7
+ $column-count-medium: 6 !default;
8
+ $column-count-small: 4 !default;
9
+ $column-count-tiny: 2 !default;
@@ -1,12 +1,12 @@
1
- $largest-medium-device: 1024px;
2
- $largest-small-device: 768px;
3
- $largest-tiny-device: 480px;
1
+ $largest-medium-device: 1024px !default;
2
+ $largest-small-device: 768px !default;
3
+ $largest-tiny-device: 480px !default;
4
4
 
5
- $media-large: "(min-width: #{$largest-medium-device + 1px})";
6
- $media-lt-large: "(max-width: #{$largest-medium-device})";
7
- $media-medium: "(min-width: #{$largest-small-device + 1px}) and (max-width: #{$largest-medium-device})";
8
- $media-gt-mobile: "(min-width: #{$largest-small-device + 1px})";
9
- $media-mobile: "(max-width: #{$largest-small-device})";
10
- $media-small: "(min-width: #{$largest-tiny-device + 1px}) and (max-width: #{$largest-small-device})";
11
- $media-gt-tiny: "(min-width: #{$largest-tiny-device + 1px})";
12
- $media-tiny: "(max-width: #{$largest-tiny-device})";
5
+ $media-large: "(min-width: #{$largest-medium-device + 1px})" !default;
6
+ $media-lt-large: "(max-width: #{$largest-medium-device})" !default;
7
+ $media-medium: "(min-width: #{$largest-small-device + 1px}) and (max-width: #{$largest-medium-device})" !default;
8
+ $media-gt-mobile: "(min-width: #{$largest-small-device + 1px})" !default;
9
+ $media-mobile: "(max-width: #{$largest-small-device})" !default;
10
+ $media-small: "(min-width: #{$largest-tiny-device + 1px}) and (max-width: #{$largest-small-device})" !default;
11
+ $media-gt-tiny: "(min-width: #{$largest-tiny-device + 1px})" !default;
12
+ $media-tiny: "(max-width: #{$largest-tiny-device})" !default;
@@ -0,0 +1,10 @@
1
+ $base-font-size-px: 16;
2
+
3
+ $font-family-main: "Open Sans", sans-serif;
4
+ $font-weight-main: 400;
5
+
6
+ $font-family-heading: supria-sans-condensed, monospace;
7
+ $font-weight-heading: 600;
8
+
9
+ $font-family-detail: "Roboto Mono", monospace;
10
+ $font-weight-detail: 500;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nationalarchives/frontend",
3
- "version": "0.1.5-prerelease",
3
+ "version": "0.1.7-prerelease",
4
4
  "description": "The National Archives frontend styles",
5
5
  "scripts": {
6
6
  "start": "storybook dev -p 6006",
7
7
  "build": "storybook build -o storybook",
8
- "lint": "prettier --check '{src,.storybook,tasks}/**/*.{js,mjs,scss,json}'",
9
- "test": "node tasks/test-fixtures.js",
10
- "prettier": "prettier --write '{src,.storybook,tasks}/**/*.{js,mjs,scss,json}'",
8
+ "test": "test-storybook --stories-json && node tasks/test-fixtures.js",
9
+ "lint": "prettier --check '{src,.storybook,tasks}/**/*.{js,mjs,scss,json}' && stylelint 'src/**/*.scss' && eslint 'src/**/*.mjs'",
10
+ "lint:fix": "prettier --write '{src,.storybook,tasks}/**/*.{js,mjs,scss,json}' && stylelint --fix 'src/**/*.scss' && eslint --fix 'src/**/*.mjs'",
11
11
  "package:sass": "sass --style=compressed --quiet-deps src/nationalarchives/all.scss package/nationalarchives/all.css",
12
12
  "package:scripts": "webpack"
13
13
  },
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "sass": "nationalarchives/all.scss",
36
36
  "engines": {
37
- "npm": "8.x",
37
+ "npm": "9.x",
38
38
  "node": "18.x"
39
39
  },
40
40
  "homepage": "https://github.com/nationalarchives/tna-frontend#readme",
@@ -45,16 +45,21 @@
45
45
  "@storybook/addon-a11y": "^7.0.22",
46
46
  "@storybook/addon-docs": "^7.0.22",
47
47
  "@storybook/addon-essentials": "^7.0.22",
48
+ "@storybook/addon-interactions": "^7.0.23",
48
49
  "@storybook/addon-links": "^7.0.22",
49
50
  "@storybook/addon-mdx-gfm": "^7.0.22",
50
51
  "@storybook/html": "^7.0.22",
51
52
  "@storybook/html-webpack5": "^7.0.22",
53
+ "@storybook/jest": "^0.1.0",
54
+ "@storybook/test-runner": "^0.11.0",
52
55
  "@storybook/testing-library": "^0.2.0",
53
56
  "babel-loader": "^9.0.1",
54
57
  "copy-webpack-plugin": "^11.0.0",
55
58
  "css-loader": "^6.7.1",
56
59
  "diff": "^5.1.0",
60
+ "eslint": "^8.43.0",
57
61
  "glob": "^10.2.7",
62
+ "jest-image-snapshot": "^6.1.0",
58
63
  "nunjucks": "^3.2.3",
59
64
  "prettier": "^2.7.1",
60
65
  "react": "^18.2.0",
@@ -64,6 +69,9 @@
64
69
  "simple-nunjucks-loader": "^3.2.0",
65
70
  "storybook": "^7.0.22",
66
71
  "style-loader": "^3.3.1",
72
+ "stylelint": "^15.9.0",
73
+ "stylelint-config-standard-scss": "^9.0.0",
74
+ "stylelint-selector-bem-pattern": "^2.1.1",
67
75
  "webpack": "^5.74.0",
68
76
  "webpack-cli": "^5.1.4"
69
77
  }
@@ -1,3 +0,0 @@
1
- @import "tools/all";
2
-
3
- @import "variables/all";
@@ -1,3 +0,0 @@
1
- $nationalarchives-assets-path: "/extension-assets/%40tna%2Ffrontend/nationalarchives/assets/";
2
-
3
- @import "all";
@@ -1,2 +0,0 @@
1
- @import "../../base";
2
- @import "./index";
@@ -1,2 +0,0 @@
1
- @import "../../base";
2
- @import "./index";
@@ -1,2 +0,0 @@
1
- @import "../../base";
2
- @import "./index";
@@ -1,2 +0,0 @@
1
- @import "../../base";
2
- @import "./index";
@@ -1,2 +0,0 @@
1
- @import "../../base";
2
- @import "./index";
@@ -1,23 +0,0 @@
1
- const argTypes = {
2
- supertitle: { control: "text" },
3
- title: { control: "text" },
4
- };
5
-
6
- export default {
7
- title: "Global styles/Typography",
8
- argTypes,
9
- };
10
-
11
- const Template = ({
12
- supertitle,
13
- title,
14
- }) => `<hgroup class="tna-hgroup tna-hgroup--heading-2">
15
- <p class="tna-hgroup__supertitle">${supertitle}</p>
16
- <h2 class="tna-hgroup__title">${title}</h2>
17
- </hgroup>`;
18
-
19
- export const HeadingGroup = Template.bind({});
20
- HeadingGroup.args = {
21
- supertitle: "The story of",
22
- title: "This is a title",
23
- };
@@ -1,15 +0,0 @@
1
- const argTypes = {
2
- text: { control: "text" },
3
- };
4
-
5
- export default {
6
- title: "Global styles/Typography",
7
- argTypes,
8
- };
9
-
10
- const BodyFontTemplate = ({ text }) => `<p>${text}</p>`;
11
-
12
- export const BodyFont = BodyFontTemplate.bind({});
13
- BodyFont.args = {
14
- text: "This is some body text",
15
- };
@@ -1,36 +0,0 @@
1
- ////
2
- /// @group tools
3
- ////
4
-
5
- /// List of modules which have already been exported
6
- ///
7
- /// @type List
8
- /// @access private
9
-
10
- $_nationalarchives-imported-modules: () !default;
11
-
12
- /// Export module
13
- ///
14
- /// Ensure that the modules of CSS that we define throughout Frontend are only
15
- /// included in the generated CSS once, no matter how many times they are
16
- /// imported across the individual components.
17
- ///
18
- /// @param {String} $name - Name of module - must be unique within the codebase
19
- /// @content The passed content will only be outputted if a module of the same
20
- /// $name has not already been outputted
21
- /// @access public
22
-
23
- @mixin nationalarchives-exports($name) {
24
- // If the mixin is not in the list of modules already exported...
25
- @if not index($_nationalarchives-imported-modules, $name) {
26
- // ... then add it to the list
27
- $_nationalarchives-imported-modules: append(
28
- $_nationalarchives-imported-modules,
29
- $name
30
- ) !global;
31
- // ... and output the CSS for that module
32
- @content;
33
- }
34
- // The next time exports is called for the module of the same name, it will be
35
- // found in the list and so nothing will be outputted.
36
- }