@nationalarchives/frontend 0.1.6-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 (49) hide show
  1. package/govuk-prototype-kit.config.json +12 -5
  2. package/nationalarchives/all.css +1 -1
  3. package/nationalarchives/all.css.map +1 -1
  4. package/nationalarchives/all.js +1 -1
  5. package/nationalarchives/all.js.map +1 -1
  6. package/nationalarchives/components/_all.scss +1 -0
  7. package/nationalarchives/components/breadcrumbs/_index.scss +68 -0
  8. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +57 -0
  9. package/nationalarchives/components/breadcrumbs/fixtures.json +26 -0
  10. package/nationalarchives/components/breadcrumbs/macro-options.json +40 -0
  11. package/nationalarchives/components/breadcrumbs/macro.njk +3 -0
  12. package/nationalarchives/components/breadcrumbs/template.njk +13 -0
  13. package/nationalarchives/components/button/_index.scss +6 -6
  14. package/nationalarchives/components/button/button.stories.js +1 -1
  15. package/nationalarchives/components/card/_index.scss +52 -61
  16. package/nationalarchives/components/card/card.stories.js +3 -3
  17. package/nationalarchives/components/card/template.njk +1 -1
  18. package/nationalarchives/components/footer/_index.scss +54 -54
  19. package/nationalarchives/components/footer/footer.stories.js +1 -1
  20. package/nationalarchives/components/grid/_index.scss +79 -82
  21. package/nationalarchives/components/grid/grid.stories.js +4 -1
  22. package/nationalarchives/components/grid/macro-options.json +7 -1
  23. package/nationalarchives/components/grid/template.njk +3 -0
  24. package/nationalarchives/components/hero/_index.scss +132 -0
  25. package/nationalarchives/components/hero/fixtures.json +4 -0
  26. package/nationalarchives/components/hero/hero.stories.js +74 -0
  27. package/nationalarchives/components/hero/macro-options.json +58 -0
  28. package/nationalarchives/components/hero/macro.njk +3 -0
  29. package/nationalarchives/components/hero/template.njk +30 -0
  30. package/nationalarchives/components/sensitive-image/_index.scss +49 -53
  31. package/nationalarchives/components/sensitive-image/sensitive-image.js +1 -1
  32. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -1
  33. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +1 -1
  34. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +37 -1
  35. package/nationalarchives/stories/development/about.mdx +1 -1
  36. package/nationalarchives/stories/development/publishing.mdx +1 -0
  37. package/nationalarchives/templates/homepage.njk +2 -2
  38. package/nationalarchives/templates/search-results.njk +38 -0
  39. package/nationalarchives/templates/topics.njk +42 -0
  40. package/nationalarchives/tools/_all.scss +1 -0
  41. package/nationalarchives/tools/_grid.scss +4 -4
  42. package/nationalarchives/tools/_media.scss +62 -0
  43. package/nationalarchives/tools/_typography.scss +2 -2
  44. package/nationalarchives/utilities/_global.scss +1 -1
  45. package/nationalarchives/utilities/_typography.scss +104 -141
  46. package/nationalarchives/variables/_all.scss +1 -0
  47. package/nationalarchives/variables/_colour.scss +1 -0
  48. package/nationalarchives/variables/_typography.scss +7 -7
  49. package/package.json +13 -5
@@ -2,27 +2,19 @@
2
2
  @use "../tools/typography" as tools;
3
3
 
4
4
  // Temporary - will eventually bundle font files into package
5
- @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=Roboto+Mono:wght@500;700&display=swap");
6
- @import url("https://use.typekit.net/hkj3kuz.css");
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";
7
7
 
8
8
  .tna-template {
9
- font-family: typography.$fontFamilyMain;
10
- font-weight: typography.$fontWeightMain;
9
+ font-family: typography.$font-family-main;
10
+ font-weight: typography.$font-weight-main;
11
11
  -moz-osx-font-smoothing: grayscale;
12
12
  -webkit-font-smoothing: antialiased;
13
13
  text-rendering: optimizeLegibility;
14
14
  -webkit-text-size-adjust: none;
15
15
  direction: ltr;
16
16
 
17
- h1,
18
- h2,
19
- h3,
20
- h4,
21
- h5,
22
- h6,
23
- p,
24
- ul,
25
- ol {
17
+ p {
26
18
  margin: 0 0 2rem;
27
19
 
28
20
  &:last-child {
@@ -31,160 +23,131 @@
31
23
  }
32
24
 
33
25
  a {
34
- &,
35
- &:link {
36
- &:hover {
37
- text-decoration-thickness: 3px;
38
- }
26
+ &:active {
27
+ text-decoration-thickness: 4px;
28
+ }
39
29
 
40
- &:active {
41
- text-decoration-thickness: 4px;
42
- }
30
+ &:hover {
31
+ text-decoration-thickness: 3px;
43
32
  }
44
33
  }
45
- }
46
34
 
47
- // $block-text-elements: p, ul, ol;
48
- // $block-text-elements-selector: "";
49
- // @each $element in $block-text-elements {
50
- // .tna-template #{$element},
51
- // .tna-#{$element} {
52
- // margin: 0 0 2rem;
53
-
54
- // outline: 1px #f90 solid;
55
-
56
- // &:first-child {
57
- // margin-top: 0;
58
- // }
59
- // }
60
- // }
61
- .tna-template p,
62
- .tna-p,
63
- .tna-template ul,
64
- .tna-ul,
65
- .tna-template ol,
66
- .tna-ol {
67
- // margin: 0 0 2rem;
68
-
69
- // outline: 1px #f90 solid;
70
-
71
- // &:first-child {
72
- // margin-top: 0;
73
- // }
74
- }
35
+ .tna-template__body {
36
+ @include tools.relative-font-size(16);
37
+ line-height: 1.6;
38
+ }
75
39
 
76
- // $list-elements: ul, ol;
77
- // @each $element in $list-elements {
78
- // .tna-template #{$element},
79
- // .tna-#{$element} {
80
- // padding-left: 2rem;
81
-
82
- // &.tna-#{$element}--plain {
83
- // padding-left: 0;
84
-
85
- // list-style: none;
86
- // }
87
- // }
88
- // }
89
- .tna-template ul,
90
- .tna-ul,
91
- .tna-template ol,
92
- .tna-ol {
93
- padding-left: 2rem;
94
-
95
- li::marker {
96
- color: #f0a;
97
- font-weight: 700;
40
+ .tna-ul,
41
+ .tna-ol {
42
+ padding-left: 2rem;
43
+
44
+ li::marker {
45
+ color: #f0a;
46
+ font-weight: 700;
47
+ }
98
48
  }
99
- }
100
49
 
101
- .tna-template .tna-ul--plain,
102
- .tna-template .tna-ol--plain {
103
- padding-left: 0;
50
+ .tna-ul--plain,
51
+ .tna-ol--plain {
52
+ padding-left: 0;
104
53
 
105
- list-style: none;
106
- }
54
+ list-style: none;
55
+ }
107
56
 
108
- .tna-template__body {
109
- @include tools.relativeFontSize(16);
110
- line-height: 1.6;
111
- }
57
+ .tna-heading {
58
+ margin-top: 0;
59
+ margin-bottom: 1.5rem;
112
60
 
113
- .tna-heading {
114
- margin-bottom: 2rem;
61
+ font-family: typography.$font-family-heading;
62
+ font-weight: typography.$font-weight-heading;
115
63
 
116
- font-family: typography.$fontFamilyHeading;
117
- font-weight: typography.$fontWeightHeading;
118
- }
64
+ &:last-child {
65
+ margin-bottom: 0;
66
+ }
119
67
 
120
- .tna-heading--xl {
121
- @include tools.relativeFontSize(64);
122
- }
68
+ &--xl {
69
+ @include tools.relative-font-size(64);
70
+ line-height: 1;
71
+ }
123
72
 
124
- .tna-heading--l {
125
- @include tools.relativeFontSize(32);
126
- }
73
+ &--l {
74
+ @include tools.relative-font-size(32);
75
+ line-height: 1.2;
76
+ }
127
77
 
128
- .tna-heading--m {
129
- @include tools.relativeFontSize(20);
130
- }
78
+ &--m {
79
+ @include tools.relative-font-size(20);
80
+ line-height: 1.4;
81
+ }
131
82
 
132
- .tna-heading--s {
133
- @include tools.relativeFontSize(18);
134
- }
83
+ &--s {
84
+ @include tools.relative-font-size(18);
85
+ line-height: 1.6;
86
+ }
87
+ }
135
88
 
136
- .tna-hgroup {
137
- }
89
+ .tna-hgroup {
90
+ margin-bottom: 2rem;
138
91
 
139
- .tna-hgroup__supertitle {
140
- @include tools.relativeFontSize(14);
141
- font-family: typography.$fontFamilyDetail;
142
- font-weight: typography.$fontWeightDetail;
143
- text-transform: uppercase;
92
+ &:last-child {
93
+ margin-bottom: 0;
94
+ }
144
95
 
145
- .tna-hgroup & {
146
- margin: 0;
147
- }
148
- }
96
+ &__supertitle {
97
+ margin: 0;
149
98
 
150
- .tna-hgroup__title {
151
- .tna-hgroup__supertitle {
152
- display: block;
153
- }
154
- }
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;
155
103
 
156
- .tna-hgroup--xl {
157
- .tna-hgroup__supertitle {
158
- }
104
+ // .tna-hgroup & {
105
+ // margin: 0;
106
+ // }
107
+ }
159
108
 
160
- .tna-hgroup__title {
161
- @include tools.relativeFontSize(64);
162
- }
163
- }
109
+ &__title {
110
+ margin: 0;
164
111
 
165
- .tna-hgroup--l {
166
- .tna-hgroup__supertitle {
167
- }
112
+ .tna-hgroup__supertitle {
113
+ display: block;
114
+ }
115
+ }
168
116
 
169
- .tna-hgroup__title {
170
- @include tools.relativeFontSize(32);
171
- }
172
- }
117
+ &--xl {
118
+ .tna-hgroup__supertitle {
119
+ }
173
120
 
174
- .tna-hgroup--m {
175
- .tna-hgroup__supertitle {
176
- }
121
+ .tna-hgroup__title {
122
+ @include tools.relative-font-size(64);
123
+ }
124
+ }
177
125
 
178
- .tna-hgroup__title {
179
- @include tools.relativeFontSize(20);
180
- }
181
- }
126
+ &--l {
127
+ .tna-hgroup__supertitle {
128
+ }
182
129
 
183
- .tna-hgroup--s {
184
- .tna-hgroup__supertitle {
185
- }
130
+ .tna-hgroup__title {
131
+ @include tools.relative-font-size(32);
132
+ }
133
+ }
134
+
135
+ &--m {
136
+ .tna-hgroup__supertitle {
137
+ }
186
138
 
187
- .tna-hgroup__title {
188
- @include tools.relativeFontSize(18);
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
+ }
189
152
  }
190
153
  }
@@ -1,3 +1,4 @@
1
+ @use "colour";
1
2
  @use "grid";
2
3
  @use "media";
3
4
  @use "typography";
@@ -0,0 +1 @@
1
+ $base-font-colour: #111 !default;
@@ -1,10 +1,10 @@
1
- $baseFontSizePx: 16;
1
+ $base-font-size-px: 16;
2
2
 
3
- $fontFamilyMain: "Open Sans", sans-serif;
4
- $fontWeightMain: 400;
3
+ $font-family-main: "Open Sans", sans-serif;
4
+ $font-weight-main: 400;
5
5
 
6
- $fontFamilyHeading: supria-sans-condensed, monospace;
7
- $fontWeightHeading: 600;
6
+ $font-family-heading: supria-sans-condensed, monospace;
7
+ $font-weight-heading: 600;
8
8
 
9
- $fontFamilyDetail: "Roboto Mono", monospace;
10
- $fontWeightDetail: 500;
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.6-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
  }