@nationalarchives/frontend 0.1.3-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 (75) hide show
  1. package/README.md +191 -0
  2. package/govuk-prototype-kit.config.json +14 -0
  3. package/nationalarchives/_base.scss +6 -0
  4. package/nationalarchives/_prototype-kit.scss +3 -0
  5. package/nationalarchives/all.css +1 -0
  6. package/nationalarchives/all.css.map +1 -0
  7. package/nationalarchives/all.js +2 -0
  8. package/nationalarchives/all.js.map +1 -0
  9. package/nationalarchives/all.mjs +13 -0
  10. package/nationalarchives/all.scss +9 -0
  11. package/nationalarchives/assets/images/apple-touch-icon-152x152.png +0 -0
  12. package/nationalarchives/assets/images/apple-touch-icon-167x167.png +0 -0
  13. package/nationalarchives/assets/images/apple-touch-icon-180x180.png +0 -0
  14. package/nationalarchives/assets/images/apple-touch-icon.png +0 -0
  15. package/nationalarchives/assets/images/favicon.ico +0 -0
  16. package/nationalarchives/assets/images/mask-icon.svg +6 -0
  17. package/nationalarchives/assets/images/nationalarchives-opengraph-image.png +0 -0
  18. package/nationalarchives/assets/images/tna-horizontal-logo-inverted.svg +51 -0
  19. package/nationalarchives/assets/images/tna-horizontal-logo.svg +51 -0
  20. package/nationalarchives/assets/images/tna-square-logo-inverted.svg +47 -0
  21. package/nationalarchives/assets/images/tna-square-logo.svg +47 -0
  22. package/nationalarchives/components/_all.scss +7 -0
  23. package/nationalarchives/components/button/_button.scss +2 -0
  24. package/nationalarchives/components/button/_index.scss +26 -0
  25. package/nationalarchives/components/button/button.stories.js +52 -0
  26. package/nationalarchives/components/button/fixtures.json +56 -0
  27. package/nationalarchives/components/button/macro-options.json +38 -0
  28. package/nationalarchives/components/button/macro.njk +3 -0
  29. package/nationalarchives/components/button/template.njk +7 -0
  30. package/nationalarchives/components/card/_card.scss +2 -0
  31. package/nationalarchives/components/card/_index.scss +37 -0
  32. package/nationalarchives/components/card/card.stories.js +77 -0
  33. package/nationalarchives/components/card/fixtures.json +29 -0
  34. package/nationalarchives/components/card/macro-options.json +96 -0
  35. package/nationalarchives/components/card/macro.njk +3 -0
  36. package/nationalarchives/components/card/template.njk +33 -0
  37. package/nationalarchives/components/footer/_footer.scss +2 -0
  38. package/nationalarchives/components/footer/_index.scss +77 -0
  39. package/nationalarchives/components/footer/fixtures.json +11 -0
  40. package/nationalarchives/components/footer/footer.stories.js +170 -0
  41. package/nationalarchives/components/footer/macro-options.json +80 -0
  42. package/nationalarchives/components/footer/macro.njk +3 -0
  43. package/nationalarchives/components/footer/template.njk +46 -0
  44. package/nationalarchives/components/grid/_grid.scss +2 -0
  45. package/nationalarchives/components/grid/_index.scss +84 -0
  46. package/nationalarchives/components/grid/fixtures.json +273 -0
  47. package/nationalarchives/components/grid/grid.stories.js +192 -0
  48. package/nationalarchives/components/grid/macro-options.json +106 -0
  49. package/nationalarchives/components/grid/macro.njk +3 -0
  50. package/nationalarchives/components/grid/template.njk +44 -0
  51. package/nationalarchives/components/sensitive-image/_index.scss +84 -0
  52. package/nationalarchives/components/sensitive-image/_sensitive-image.scss +2 -0
  53. package/nationalarchives/components/sensitive-image/fixtures.json +54 -0
  54. package/nationalarchives/components/sensitive-image/macro-options.json +58 -0
  55. package/nationalarchives/components/sensitive-image/macro.njk +3 -0
  56. package/nationalarchives/components/sensitive-image/sensitive-image.js +2 -0
  57. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -0
  58. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +26 -0
  59. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +49 -0
  60. package/nationalarchives/components/sensitive-image/template.njk +10 -0
  61. package/nationalarchives/stories/development/structure.mdx +7 -0
  62. package/nationalarchives/stories/global/heading-groups.stories.js +23 -0
  63. package/nationalarchives/stories/global/headings.stories.js +40 -0
  64. package/nationalarchives/stories/global/typography.mdx +22 -0
  65. package/nationalarchives/stories/global/typography.stories.js +15 -0
  66. package/nationalarchives/tools/_all.scss +1 -0
  67. package/nationalarchives/tools/_exports.scss +36 -0
  68. package/nationalarchives/utilities/_all.scss +3 -0
  69. package/nationalarchives/utilities/_global.scss +39 -0
  70. package/nationalarchives/utilities/_grid.scss +131 -0
  71. package/nationalarchives/utilities/_typography.scss +82 -0
  72. package/nationalarchives/variables/_all.scss +2 -0
  73. package/nationalarchives/variables/_grid.scss +9 -0
  74. package/nationalarchives/variables/_media.scss +12 -0
  75. package/package.json +70 -0
@@ -0,0 +1,80 @@
1
+ [
2
+ {
3
+ "name": "navigation",
4
+ "type": "array",
5
+ "required": false,
6
+ "description": "",
7
+ "params": [
8
+ {
9
+ "name": "title",
10
+ "type": "string",
11
+ "required": true,
12
+ "description": ""
13
+ },
14
+ {
15
+ "name": "items",
16
+ "type": "array",
17
+ "required": true,
18
+ "description": "",
19
+ "params": [
20
+ {
21
+ "name": "text",
22
+ "type": "string",
23
+ "required": true,
24
+ "description": ""
25
+ },
26
+ {
27
+ "name": "href",
28
+ "type": "string",
29
+ "required": true,
30
+ "description": ""
31
+ },
32
+ {
33
+ "name": "title",
34
+ "type": "string",
35
+ "required": false,
36
+ "description": ""
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "name": "social",
44
+ "type": "array",
45
+ "required": false,
46
+ "description": "",
47
+ "params": [
48
+ {
49
+ "name": "text",
50
+ "type": "string",
51
+ "required": true,
52
+ "description": ""
53
+ },
54
+ {
55
+ "name": "href",
56
+ "type": "string",
57
+ "required": true,
58
+ "description": ""
59
+ },
60
+ {
61
+ "name": "title",
62
+ "type": "string",
63
+ "required": false,
64
+ "description": ""
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "name": "classes",
70
+ "type": "string",
71
+ "required": false,
72
+ "description": "Classes to add to the footer."
73
+ },
74
+ {
75
+ "name": "attributes",
76
+ "type": "object",
77
+ "required": false,
78
+ "description": "HTML attributes (for example data attributes) to add to the footer."
79
+ }
80
+ ]
@@ -0,0 +1,3 @@
1
+ {% macro tnaFooter(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,46 @@
1
+ {%- set containerClasses = [params.classes] if params.classes else [] -%}
2
+ <footer class="tna-footer {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
3
+ {%- if params.navigation -%}
4
+ <div class="tna-container tna-footer__navigation">
5
+ {%- for group in params.navigation -%}
6
+ <div class="tna-column tna-column--flex-1 tna-footer__navigation-group">
7
+ <h4 class="tna-footer__navigation-group-title">{{ group.title }}</h4>
8
+ <ul class="tna-footer__navigation-group-items">
9
+ {%- for item in group.items -%}
10
+ <li class="tna-footer__navigation-group-item">
11
+ <a href="{{ item.href }}" class="tna-footer__navigation-group-item-link tna-footer__link" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
12
+ </li>
13
+ {%- endfor -%}
14
+ </ul>
15
+ </div>
16
+ {%- endfor -%}
17
+ </div>
18
+ {%- endif -%}
19
+ {%- if params.social -%}
20
+ <div class="tna-container tna-footer__social">
21
+ {%- for item in params.social -%}
22
+ <div class="tna-column tna-column--flex-1 tna-footer__social-item">
23
+ <a href="{{ item.href }}" class="tna-footer__social-item-link tna-footer__link" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
24
+ </div>
25
+ {%- endfor -%}
26
+ </div>
27
+ {%- endif -%}
28
+ <div class="tna-container">
29
+ <div class="tna-column">
30
+ <svg aria-hidden="true" focusable="false" class="tna-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
31
+ <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
32
+ </svg>
33
+ </div>
34
+ <div class="tna-column tna-column--flex-1">
35
+ <p>All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" class="tna-footer__link">Open Government Licence v3.0</a>, except where otherwise stated</p>
36
+ </div>
37
+ <div class="tna-column">
38
+ <a href="#" class="tna-footer__govuk-link">
39
+ <svg aria-hidden="true" class="tna-footer__govuk-logotype-crown" focusable="false" height="30" viewBox="0 0 132 97" width="36" xmlns="http://www.w3.org/2000/svg">
40
+ <path d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
41
+ </svg>
42
+ GOV.UK
43
+ </a>
44
+ </div>
45
+ </div>
46
+ </footer>
@@ -0,0 +1,2 @@
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,84 @@
1
+ @use "sass:math";
2
+
3
+ @import "../../variables/all";
4
+ @import "../../utilities/grid";
5
+
6
+ @include nationalarchives-exports("nationalarchives/utilities/grid") {
7
+ .tna-container {
8
+ max-width: $largest-container-width;
9
+ width: 100%;
10
+ margin-right: auto;
11
+ margin-left: auto;
12
+ padding-right: math.div($gutter-width, 2);
13
+ padding-left: math.div($gutter-width, 2);
14
+
15
+ box-sizing: border-box;
16
+
17
+ display: -ms-flexbox;
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ justify-content: stretch;
21
+ align-items: stretch;
22
+
23
+ &.tna-container--max {
24
+ max-width: none;
25
+ }
26
+
27
+ &.tna-container--no-padding {
28
+ max-width: $largest-container-width - ($gutter-width * 2);
29
+ padding-right: 0;
30
+ padding-left: 0;
31
+
32
+ .tna-column {
33
+ padding-right: 0;
34
+ padding-left: 0;
35
+ }
36
+ }
37
+ }
38
+
39
+ .tna-column {
40
+ padding-right: math.div($gutter-width, 2);
41
+ padding-left: math.div($gutter-width, 2);
42
+
43
+ box-sizing: border-box;
44
+
45
+ &.tna-column--full {
46
+ width: 100%;
47
+ }
48
+
49
+ // &.column--no-padding {
50
+ // padding-right: 0;
51
+ // padding-left: 0;
52
+ // }
53
+ }
54
+
55
+ @for $i from 1 through 3 {
56
+ .tna-column--flex-#{$i} {
57
+ flex: $i 0;
58
+ }
59
+ }
60
+
61
+ // @for $i from 1 through 3 {
62
+ // .column--order-#{$i} {
63
+ // order: $i;
64
+ // }
65
+ // }
66
+
67
+ @include columns-generator($column-count);
68
+
69
+ @media #{$media-medium} {
70
+ @include grid-medium;
71
+ }
72
+
73
+ @media #{$media-mobile} {
74
+ @include grid-mobile;
75
+ }
76
+
77
+ @media #{$media-small} {
78
+ @include grid-small;
79
+ }
80
+
81
+ @media #{$media-tiny} {
82
+ @include grid-tiny;
83
+ }
84
+ }
@@ -0,0 +1,273 @@
1
+ {
2
+ "component": "grid",
3
+ "fixtures": [
4
+ {
5
+ "name": "container only",
6
+ "options": {},
7
+ "html": "<div class=\"tna-container \"></div>",
8
+ "hidden": false
9
+ },
10
+ {
11
+ "name": "container max width",
12
+ "options": {
13
+ "maxWidth": true,
14
+ "columns": [
15
+ {
16
+ "html": "<p>Full width</p>",
17
+ "width": "full"
18
+ }
19
+ ]
20
+ },
21
+ "html": "<div class=\"tna-container tna-container--max\"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div></div>",
22
+ "hidden": false
23
+ },
24
+ {
25
+ "name": "container no padding",
26
+ "options": {
27
+ "noPadding": true,
28
+ "columns": [
29
+ {
30
+ "html": "<p>Full width</p>",
31
+ "width": "full"
32
+ }
33
+ ]
34
+ },
35
+ "html": "<div class=\"tna-container tna-container--no-padding\"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div></div>",
36
+ "hidden": false
37
+ },
38
+ {
39
+ "name": "container element",
40
+ "options": {
41
+ "htmlElement": "article",
42
+ "columns": [
43
+ {
44
+ "html": "<p>Full width</p>",
45
+ "width": "full"
46
+ }
47
+ ]
48
+ },
49
+ "html": "<article class=\"tna-container \"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div></article>",
50
+ "hidden": false
51
+ },
52
+ {
53
+ "name": "container classes",
54
+ "options": {
55
+ "classes": "container__test-class",
56
+ "columns": [
57
+ {
58
+ "html": "<p>Full width</p>",
59
+ "width": "full"
60
+ }
61
+ ]
62
+ },
63
+ "html": "<div class=\"tna-container container__test-class\"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div></div>",
64
+ "hidden": false
65
+ },
66
+ {
67
+ "name": "container attributes",
68
+ "options": {
69
+ "attributes": {
70
+ "data-testattribute": "foobar"
71
+ },
72
+ "columns": [
73
+ {
74
+ "html": "<p>Full width</p>",
75
+ "width": "full"
76
+ }
77
+ ]
78
+ },
79
+ "html": "<div class=\"tna-container \" data-testattribute=\"foobar\"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div></div>",
80
+ "hidden": false
81
+ },
82
+ {
83
+ "name": "different columns",
84
+ "options": {
85
+ "columns": [
86
+ {
87
+ "html": "<p>Full width</p>",
88
+ "width": "full"
89
+ },
90
+ {
91
+ "html": "<p>Half</p>",
92
+ "width": "1-2"
93
+ },
94
+ {
95
+ "html": "<p>Half</p>",
96
+ "width": "1-2"
97
+ },
98
+ {
99
+ "html": "<p>Third</p>",
100
+ "width": "1-3"
101
+ },
102
+ {
103
+ "html": "<p>Third</p>",
104
+ "width": "1-3"
105
+ },
106
+ {
107
+ "html": "<p>Third</p>",
108
+ "width": "1-3"
109
+ },
110
+ {
111
+ "html": "<p>Two thirds</p>",
112
+ "width": "2-3"
113
+ },
114
+ {
115
+ "html": "<p>Third</p>",
116
+ "width": "1-3"
117
+ },
118
+ {
119
+ "html": "<p>Third</p>",
120
+ "width": "1-3"
121
+ },
122
+ {
123
+ "html": "<p>Two thirds</p>",
124
+ "width": "2-3"
125
+ },
126
+ {
127
+ "html": "<p>Quarter</p>",
128
+ "width": "1-4"
129
+ },
130
+ {
131
+ "html": "<p>Quarter</p>",
132
+ "width": "1-4"
133
+ },
134
+ {
135
+ "html": "<p>Quarter</p>",
136
+ "width": "1-4"
137
+ },
138
+ {
139
+ "html": "<p>Quarter</p>",
140
+ "width": "1-4"
141
+ },
142
+ {
143
+ "html": "<p>Half</p>",
144
+ "width": "1-2"
145
+ },
146
+ {
147
+ "html": "<p>Quarter</p>",
148
+ "width": "1-4"
149
+ },
150
+ {
151
+ "html": "<p>Quarter</p>",
152
+ "width": "1-4"
153
+ },
154
+ {
155
+ "html": "<p>Quarter</p>",
156
+ "width": "1-4"
157
+ },
158
+ {
159
+ "html": "<p>Half</p>",
160
+ "width": "1-2"
161
+ },
162
+ {
163
+ "html": "<p>Quarter</p>",
164
+ "width": "1-4"
165
+ },
166
+ {
167
+ "html": "<p>Quarter</p>",
168
+ "width": "1-4"
169
+ },
170
+ {
171
+ "html": "<p>Quarter</p>",
172
+ "width": "1-4"
173
+ },
174
+ {
175
+ "html": "<p>Half</p>",
176
+ "width": "1-2"
177
+ }
178
+ ]
179
+ },
180
+ "html": "<div class=\"tna-container \"><div class=\"tna-column tna-column--full\">\n <p>Full width</p>\n </div><div class=\"tna-column tna-column--width-1-2\">\n <p>Half</p>\n </div><div class=\"tna-column tna-column--width-1-2\">\n <p>Half</p>\n </div><div class=\"tna-column tna-column--width-1-3\">\n <p>Third</p>\n </div><div class=\"tna-column tna-column--width-1-3\">\n <p>Third</p>\n </div><div class=\"tna-column tna-column--width-1-3\">\n <p>Third</p>\n </div><div class=\"tna-column tna-column--width-2-3\">\n <p>Two thirds</p>\n </div><div class=\"tna-column tna-column--width-1-3\">\n <p>Third</p>\n </div><div class=\"tna-column tna-column--width-1-3\">\n <p>Third</p>\n </div><div class=\"tna-column tna-column--width-2-3\">\n <p>Two thirds</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-2\">\n <p>Half</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-2\">\n <p>Half</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-4\">\n <p>Quarter</p>\n </div><div class=\"tna-column tna-column--width-1-2\">\n <p>Half</p>\n </div></div>",
181
+ "hidden": false
182
+ },
183
+ {
184
+ "name": "column widths",
185
+ "options": {
186
+ "columns": [
187
+ {
188
+ "html": "<p>Full width</p>",
189
+ "width": "full",
190
+ "widthMedium": "full",
191
+ "widthSmall": "full",
192
+ "widthTiny": "full"
193
+ }
194
+ ]
195
+ },
196
+ "html": "<div class=\"tna-container \"><div class=\"tna-column tna-column--full tna-column--full-medium tna-column--full-small tna-column--full-tiny\">\n <p>Full width</p>\n </div></div>",
197
+ "hidden": false
198
+ },
199
+ {
200
+ "name": "responsive column widths",
201
+ "options": {
202
+ "columns": [
203
+ {
204
+ "html": "<p>Full width</p>",
205
+ "width": "1-5",
206
+ "widthMedium": "1-4",
207
+ "widthSmall": "1-3",
208
+ "widthTiny": "1-2"
209
+ }
210
+ ]
211
+ },
212
+ "html": "<div class=\"tna-container \"><div class=\"tna-column tna-column--width-1-5 tna-column--width-1-4-medium tna-column--width-1-3-small tna-column--width-1-2-tiny\">\n <p>Full width</p>\n </div></div>",
213
+ "hidden": false
214
+ },
215
+ {
216
+ "name": "flexible column widths",
217
+ "options": {
218
+ "columns": [
219
+ {
220
+ "html": "<p>Full width</p>",
221
+ "flex": "4",
222
+ "flexMedium": "3",
223
+ "flexSmall": "2",
224
+ "flexTiny": "1"
225
+ }
226
+ ]
227
+ },
228
+ "html": "<div class=\"tna-container \"><div class=\"tna-column tna-column--flex-4 tna-column--flex-3-medium tna-column--flex-2-small tna-column--flex-1-tiny\">\n <p>Full width</p>\n </div></div>",
229
+ "hidden": false
230
+ },
231
+ {
232
+ "name": "column element",
233
+ "options": {
234
+ "columns": [
235
+ {
236
+ "html": "<p>Full width</p>",
237
+ "element": "section"
238
+ }
239
+ ]
240
+ },
241
+ "html": "<div class=\"tna-container \"><div class=\"tna-column \">\n <p>Full width</p>\n </div></div>",
242
+ "hidden": false
243
+ },
244
+ {
245
+ "name": "column classes",
246
+ "options": {
247
+ "columns": [
248
+ {
249
+ "html": "<p>Full width</p>",
250
+ "classes": "column--test-class"
251
+ }
252
+ ]
253
+ },
254
+ "html": "<div class=\"tna-container \"><div class=\"tna-column column--test-class\">\n <p>Full width</p>\n </div></div>",
255
+ "hidden": false
256
+ },
257
+ {
258
+ "name": "column attributes",
259
+ "options": {
260
+ "columns": [
261
+ {
262
+ "html": "<p>Full width</p>",
263
+ "attributes": {
264
+ "data-testattribute": "foobar"
265
+ }
266
+ }
267
+ ]
268
+ },
269
+ "html": "<div class=\"tna-container \"><div class=\"tna-column \" data-testattribute=\"foobar\">\n <p>Full width</p>\n </div></div>",
270
+ "hidden": false
271
+ }
272
+ ]
273
+ }
@@ -0,0 +1,192 @@
1
+ import Header from "./template.njk";
2
+ import "../../all.scss";
3
+ import "./_grid.scss";
4
+ import macroOptions from "./macro-options.json";
5
+
6
+ const argTypes = {
7
+ columns: { control: "object" },
8
+ maxWidth: { control: "boolean" },
9
+ noPadding: { control: "boolean" },
10
+ htmlElement: { control: "text" },
11
+ classes: { control: "text" },
12
+ attributes: { control: "text" },
13
+ };
14
+
15
+ Object.keys(argTypes).forEach((argType) => {
16
+ argTypes[argType].description = macroOptions.find(
17
+ (option) => option.name === argType
18
+ )?.description;
19
+ });
20
+
21
+ export default {
22
+ title: "Utilities/Grid",
23
+ argTypes,
24
+ };
25
+
26
+ const Template = ({
27
+ columns,
28
+ maxWidth,
29
+ noPadding,
30
+ htmlElement,
31
+ classes,
32
+ attributes,
33
+ }) => {
34
+ return Header({
35
+ params: {
36
+ columns,
37
+ maxWidth,
38
+ noPadding,
39
+ htmlElement,
40
+ classes,
41
+ attributes,
42
+ },
43
+ });
44
+ };
45
+
46
+ export const Standard = Template.bind({});
47
+ Standard.args = {
48
+ classes: "tna-container--demo",
49
+ columns: [
50
+ {
51
+ html: "<p>Full width</p>",
52
+ width: "full",
53
+ },
54
+ {
55
+ html: "<p>Half</p>",
56
+ width: "1-2",
57
+ },
58
+ {
59
+ html: "<p>Half</p>",
60
+ width: "1-2",
61
+ },
62
+ {
63
+ html: "<p>Third</p>",
64
+ width: "1-3",
65
+ },
66
+ {
67
+ html: "<p>Third</p>",
68
+ width: "1-3",
69
+ },
70
+ {
71
+ html: "<p>Third</p>",
72
+ width: "1-3",
73
+ },
74
+ {
75
+ html: "<p>Two thirds</p>",
76
+ width: "2-3",
77
+ },
78
+ {
79
+ html: "<p>Third</p>",
80
+ width: "1-3",
81
+ },
82
+ {
83
+ html: "<p>Third</p>",
84
+ width: "1-3",
85
+ },
86
+ {
87
+ html: "<p>Two thirds</p>",
88
+ width: "2-3",
89
+ },
90
+ {
91
+ html: "<p>Quarter</p>",
92
+ width: "1-4",
93
+ },
94
+ {
95
+ html: "<p>Quarter</p>",
96
+ width: "1-4",
97
+ },
98
+ {
99
+ html: "<p>Quarter</p>",
100
+ width: "1-4",
101
+ },
102
+ {
103
+ html: "<p>Quarter</p>",
104
+ width: "1-4",
105
+ },
106
+ {
107
+ html: "<p>Half</p>",
108
+ width: "1-2",
109
+ },
110
+ {
111
+ html: "<p>Quarter</p>",
112
+ width: "1-4",
113
+ },
114
+ {
115
+ html: "<p>Quarter</p>",
116
+ width: "1-4",
117
+ },
118
+ {
119
+ html: "<p>Quarter</p>",
120
+ width: "1-4",
121
+ },
122
+ {
123
+ html: "<p>Half</p>",
124
+ width: "1-2",
125
+ },
126
+ {
127
+ html: "<p>Quarter</p>",
128
+ width: "1-4",
129
+ },
130
+ {
131
+ html: "<p>Quarter</p>",
132
+ width: "1-4",
133
+ },
134
+ {
135
+ html: "<p>Quarter</p>",
136
+ width: "1-4",
137
+ },
138
+ {
139
+ html: "<p>Half</p>",
140
+ width: "1-2",
141
+ },
142
+ {
143
+ html: "<p>Sixth</p>",
144
+ width: "1-6",
145
+ },
146
+ {
147
+ html: "<p>Sixth</p>",
148
+ width: "1-6",
149
+ },
150
+ {
151
+ html: "<p>Sixth</p>",
152
+ width: "1-6",
153
+ },
154
+ {
155
+ html: "<p>Sixth</p>",
156
+ width: "1-6",
157
+ },
158
+ {
159
+ html: "<p>Sixth</p>",
160
+ width: "1-6",
161
+ },
162
+ {
163
+ html: "<p>Sixth</p>",
164
+ width: "1-6",
165
+ },
166
+ {
167
+ html: "<p>Half</p>",
168
+ width: "1-2",
169
+ },
170
+ {
171
+ html: "<p>Third</p>",
172
+ width: "1-3",
173
+ },
174
+ {
175
+ html: "<p>Sixth</p>",
176
+ width: "1-6",
177
+ },
178
+ ],
179
+ };
180
+
181
+ export const Responsive = Template.bind({});
182
+ const responsiveColumn = {
183
+ html: "<p>Responsive</p>",
184
+ width: "1-4",
185
+ widthMedium: "1-3",
186
+ widthSmall: "1-2",
187
+ widthTiny: "full",
188
+ };
189
+ Responsive.args = {
190
+ classes: "tna-container--demo",
191
+ columns: Array(12).fill({ ...responsiveColumn }),
192
+ };