@nationalarchives/frontend 0.1.5-prerelease → 0.1.6-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 (51) hide show
  1. package/README.md +1 -1
  2. package/govuk-prototype-kit.config.json +10 -2
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.scss +4 -3
  6. package/nationalarchives/components/_all.scss +5 -7
  7. package/nationalarchives/components/button/_index.scss +15 -16
  8. package/nationalarchives/components/button/button.stories.js +1 -2
  9. package/nationalarchives/components/card/_index.scss +71 -24
  10. package/nationalarchives/components/card/card.stories.js +41 -10
  11. package/nationalarchives/components/card/fixtures.json +135 -7
  12. package/nationalarchives/components/card/macro-options.json +42 -10
  13. package/nationalarchives/components/card/template.njk +53 -24
  14. package/nationalarchives/components/footer/_index.scss +61 -51
  15. package/nationalarchives/components/footer/fixtures.json +1 -1
  16. package/nationalarchives/components/footer/footer.stories.js +22 -2
  17. package/nationalarchives/components/footer/macro-options.json +12 -0
  18. package/nationalarchives/components/footer/template.njk +16 -5
  19. package/nationalarchives/components/grid/_index.scss +127 -52
  20. package/nationalarchives/components/grid/grid.stories.js +2 -3
  21. package/nationalarchives/components/sensitive-image/_index.scss +55 -58
  22. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +1 -2
  23. package/nationalarchives/stories/design/about.mdx +25 -0
  24. package/nationalarchives/stories/utilities/heading-groups.stories.js +44 -0
  25. package/nationalarchives/stories/{global → utilities}/headings.stories.js +1 -1
  26. package/nationalarchives/stories/utilities/lists.stories.js +38 -0
  27. package/nationalarchives/stories/{global → utilities}/typography.mdx +8 -8
  28. package/nationalarchives/stories/utilities/typography.stories.js +14 -0
  29. package/nationalarchives/templates/homepage.njk +64 -0
  30. package/nationalarchives/templates/layouts/_generic.njk +60 -0
  31. package/nationalarchives/tools/_all.scss +2 -2
  32. package/nationalarchives/tools/_grid.scss +4 -91
  33. package/nationalarchives/tools/_typography.scss +6 -0
  34. package/nationalarchives/utilities/_all.scss +2 -2
  35. package/nationalarchives/utilities/_global.scss +8 -0
  36. package/nationalarchives/utilities/_typography.scss +126 -18
  37. package/nationalarchives/variables/_all.scss +3 -2
  38. package/nationalarchives/variables/_grid.scss +7 -7
  39. package/nationalarchives/variables/_media.scss +11 -11
  40. package/nationalarchives/variables/_typography.scss +10 -0
  41. package/package.json +1 -1
  42. package/nationalarchives/_base.scss +0 -3
  43. package/nationalarchives/_prototype-kit.scss +0 -3
  44. package/nationalarchives/components/button/_button.scss +0 -2
  45. package/nationalarchives/components/card/_card.scss +0 -2
  46. package/nationalarchives/components/footer/_footer.scss +0 -2
  47. package/nationalarchives/components/grid/_grid.scss +0 -2
  48. package/nationalarchives/components/sensitive-image/_sensitive-image.scss +0 -2
  49. package/nationalarchives/stories/global/heading-groups.stories.js +0 -23
  50. package/nationalarchives/stories/global/typography.stories.js +0 -15
  51. package/nationalarchives/tools/_exports.scss +0 -36
@@ -1,49 +1,164 @@
1
+ @use "../variables/typography";
2
+ @use "../tools/typography" as tools;
3
+
1
4
  // Temporary - will eventually bundle font files into package
2
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");
3
7
 
4
8
  .tna-template {
5
- font-family: "Open Sans", sans-serif;
6
- font-size: 16px;
9
+ font-family: typography.$fontFamilyMain;
10
+ font-weight: typography.$fontWeightMain;
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;
16
+
17
+ h1,
18
+ h2,
19
+ h3,
20
+ h4,
21
+ h5,
22
+ h6,
23
+ p,
24
+ ul,
25
+ ol {
26
+ margin: 0 0 2rem;
27
+
28
+ &:last-child {
29
+ margin-bottom: 0;
30
+ }
31
+ }
32
+
33
+ a {
34
+ &,
35
+ &:link {
36
+ &:hover {
37
+ text-decoration-thickness: 3px;
38
+ }
39
+
40
+ &:active {
41
+ text-decoration-thickness: 4px;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
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
+ }
75
+
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;
98
+ }
99
+ }
100
+
101
+ .tna-template .tna-ul--plain,
102
+ .tna-template .tna-ol--plain {
103
+ padding-left: 0;
104
+
105
+ list-style: none;
12
106
  }
13
107
 
14
108
  .tna-template__body {
15
- font-size: 1rem;
109
+ @include tools.relativeFontSize(16);
16
110
  line-height: 1.6;
17
111
  }
18
112
 
19
113
  .tna-heading {
114
+ margin-bottom: 2rem;
115
+
116
+ font-family: typography.$fontFamilyHeading;
117
+ font-weight: typography.$fontWeightHeading;
20
118
  }
21
119
 
22
120
  .tna-heading--xl {
23
- font-size: 4rem;
121
+ @include tools.relativeFontSize(64);
24
122
  }
25
123
 
26
124
  .tna-heading--l {
27
- font-size: 2rem;
125
+ @include tools.relativeFontSize(32);
28
126
  }
29
127
 
30
128
  .tna-heading--m {
31
- font-size: 1.3rem;
129
+ @include tools.relativeFontSize(20);
32
130
  }
33
131
 
34
132
  .tna-heading--s {
35
- font-size: 1.125rem;
133
+ @include tools.relativeFontSize(18);
36
134
  }
37
135
 
38
136
  .tna-hgroup {
39
137
  }
40
138
 
139
+ .tna-hgroup__supertitle {
140
+ @include tools.relativeFontSize(14);
141
+ font-family: typography.$fontFamilyDetail;
142
+ font-weight: typography.$fontWeightDetail;
143
+ text-transform: uppercase;
144
+
145
+ .tna-hgroup & {
146
+ margin: 0;
147
+ }
148
+ }
149
+
150
+ .tna-hgroup__title {
151
+ .tna-hgroup__supertitle {
152
+ display: block;
153
+ }
154
+ }
155
+
41
156
  .tna-hgroup--xl {
42
157
  .tna-hgroup__supertitle {
43
158
  }
44
159
 
45
160
  .tna-hgroup__title {
46
- font-size: 4rem;
161
+ @include tools.relativeFontSize(64);
47
162
  }
48
163
  }
49
164
 
@@ -52,7 +167,7 @@
52
167
  }
53
168
 
54
169
  .tna-hgroup__title {
55
- font-size: 2rem;
170
+ @include tools.relativeFontSize(32);
56
171
  }
57
172
  }
58
173
 
@@ -61,7 +176,7 @@
61
176
  }
62
177
 
63
178
  .tna-hgroup__title {
64
- font-size: 1.3rem;
179
+ @include tools.relativeFontSize(20);
65
180
  }
66
181
  }
67
182
 
@@ -70,13 +185,6 @@
70
185
  }
71
186
 
72
187
  .tna-hgroup__title {
73
- font-size: 1.125rem;
188
+ @include tools.relativeFontSize(18);
74
189
  }
75
190
  }
76
-
77
- .tna-hgroup__supertitle {
78
- text-transform: uppercase;
79
- }
80
-
81
- .tna-hgroup__title {
82
- }
@@ -1,2 +1,3 @@
1
- @import "grid";
2
- @import "media";
1
+ @use "grid";
2
+ @use "media";
3
+ @use "typography";
@@ -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
+ $baseFontSizePx: 16;
2
+
3
+ $fontFamilyMain: "Open Sans", sans-serif;
4
+ $fontWeightMain: 400;
5
+
6
+ $fontFamilyHeading: supria-sans-condensed, monospace;
7
+ $fontWeightHeading: 600;
8
+
9
+ $fontFamilyDetail: "Roboto Mono", monospace;
10
+ $fontWeightDetail: 500;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nationalarchives/frontend",
3
- "version": "0.1.5-prerelease",
3
+ "version": "0.1.6-prerelease",
4
4
  "description": "The National Archives frontend styles",
5
5
  "scripts": {
6
6
  "start": "storybook dev -p 6006",
@@ -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
- }