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