@nationalarchives/frontend 0.1.8-prerelease → 0.1.10-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 (94) hide show
  1. package/README.md +2 -2
  2. package/nationalarchives/_features.scss +1 -0
  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.mjs +53 -6
  8. package/nationalarchives/assets/images/footer/facebook.svg +11 -0
  9. package/nationalarchives/assets/images/footer/flickr.svg +11 -0
  10. package/nationalarchives/assets/images/footer/instagram.svg +17 -0
  11. package/nationalarchives/assets/images/footer/rss.svg +13 -0
  12. package/nationalarchives/assets/images/footer/twitter.svg +14 -0
  13. package/nationalarchives/assets/images/footer/youtube.svg +12 -0
  14. package/nationalarchives/assets/images/tna-square-logo.svg +24 -45
  15. package/nationalarchives/components/_all.scss +4 -0
  16. package/nationalarchives/components/breadcrumbs/_index.scss +4 -3
  17. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +2 -3
  18. package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
  19. package/nationalarchives/components/breadcrumbs/macro-options.json +2 -2
  20. package/nationalarchives/components/breadcrumbs/template.njk +9 -9
  21. package/nationalarchives/components/button/_index.scss +25 -5
  22. package/nationalarchives/components/button/button.stories.js +2 -3
  23. package/nationalarchives/components/button/fixtures.json +5 -5
  24. package/nationalarchives/components/button/template.njk +3 -3
  25. package/nationalarchives/components/card/_index.scss +7 -3
  26. package/nationalarchives/components/card/card.stories.js +2 -3
  27. package/nationalarchives/components/card/fixtures.json +11 -11
  28. package/nationalarchives/components/card/template.njk +44 -44
  29. package/nationalarchives/components/filters/_index.scss +49 -0
  30. package/nationalarchives/components/filters/filters.stories.js +75 -0
  31. package/nationalarchives/components/filters/fixtures.json +4 -0
  32. package/nationalarchives/components/filters/macro-options.json +52 -0
  33. package/nationalarchives/components/filters/macro.njk +3 -0
  34. package/nationalarchives/components/filters/template.njk +8 -0
  35. package/nationalarchives/components/footer/_index.scss +49 -4
  36. package/nationalarchives/components/footer/fixtures.json +1 -1
  37. package/nationalarchives/components/footer/footer.stories.js +23 -26
  38. package/nationalarchives/components/footer/macro-options.json +12 -6
  39. package/nationalarchives/components/footer/template.njk +61 -51
  40. package/nationalarchives/components/grid/_index.scss +3 -78
  41. package/nationalarchives/components/grid/fixtures.json +12 -12
  42. package/nationalarchives/components/grid/grid.stories.js +3 -4
  43. package/nationalarchives/components/grid/template.njk +35 -35
  44. package/nationalarchives/components/header/_index.scss +452 -0
  45. package/nationalarchives/components/header/fixtures.json +4 -0
  46. package/nationalarchives/components/header/header.js +2 -0
  47. package/nationalarchives/components/header/header.js.map +1 -0
  48. package/nationalarchives/components/header/header.mjs +108 -0
  49. package/nationalarchives/components/header/header.stories.js +68 -0
  50. package/nationalarchives/components/header/macro-options.json +104 -0
  51. package/nationalarchives/components/header/macro.njk +3 -0
  52. package/nationalarchives/components/header/template.njk +66 -0
  53. package/nationalarchives/components/hero/_index.scss +4 -1
  54. package/nationalarchives/components/hero/hero.stories.js +17 -15
  55. package/nationalarchives/components/hero/macro-options.json +3 -3
  56. package/nationalarchives/components/hero/template.njk +27 -27
  57. package/nationalarchives/components/phase-banner/_index.scss +43 -0
  58. package/nationalarchives/components/phase-banner/fixtures.json +14 -0
  59. package/nationalarchives/components/phase-banner/macro-options.json +26 -0
  60. package/nationalarchives/components/phase-banner/macro.njk +3 -0
  61. package/nationalarchives/components/phase-banner/phase-banner.stories.js +38 -0
  62. package/nationalarchives/components/phase-banner/template.njk +16 -0
  63. package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
  64. package/nationalarchives/components/sensitive-image/macro-options.json +2 -2
  65. package/nationalarchives/components/sensitive-image/sensitive-image.js +1 -1
  66. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -1
  67. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +21 -22
  68. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +2 -3
  69. package/nationalarchives/components/sensitive-image/template.njk +7 -7
  70. package/nationalarchives/lib/uuid.mjs +9 -0
  71. package/nationalarchives/stories/development/contributing.mdx +38 -0
  72. package/nationalarchives/stories/development/dependencies.mdx +2 -0
  73. package/nationalarchives/stories/development/publishing.mdx +9 -0
  74. package/nationalarchives/stories/development/technologies.mdx +65 -0
  75. package/nationalarchives/stories/utilities/lists.stories.js +2 -2
  76. package/nationalarchives/stories/utilities/typography.mdx +15 -0
  77. package/nationalarchives/templates/homepage.njk +46 -46
  78. package/nationalarchives/templates/layouts/_generic.njk +49 -52
  79. package/nationalarchives/templates/layouts/_prototype-kit.njk +5 -0
  80. package/nationalarchives/templates/search-results.njk +31 -31
  81. package/nationalarchives/templates/topics.njk +33 -33
  82. package/nationalarchives/tools/_all.scss +1 -0
  83. package/nationalarchives/tools/_assets.scss +5 -0
  84. package/nationalarchives/tools/_grid.scss +52 -27
  85. package/nationalarchives/tools/_media.scss +12 -11
  86. package/nationalarchives/utilities/_global.scss +103 -3
  87. package/nationalarchives/utilities/_typography.scss +112 -92
  88. package/nationalarchives/variables/_all.scss +1 -0
  89. package/nationalarchives/variables/_assets.scss +1 -0
  90. package/nationalarchives/variables/_colour.scss +95 -1
  91. package/nationalarchives/variables/_media.scss +39 -11
  92. package/package.json +18 -16
  93. package/nationalarchives/assets/images/tna-square-logo-inverted.svg +0 -47
  94. package/nationalarchives/stories/development/structure.mdx +0 -7
@@ -1,3 +1,5 @@
1
+ @use "../../variables/colour";
2
+
1
3
  .tna-button {
2
4
  padding: 0.25rem 1rem;
3
5
 
@@ -7,19 +9,37 @@
7
9
  font-weight: 700;
8
10
  text-decoration: none;
9
11
 
10
- background-color: #000;
12
+ background-color: colour.$tna-black;
13
+
14
+ border: 0.25rem colour.$tna-black solid;
15
+
16
+ transition:
17
+ color 200ms,
18
+ background-color 200ms,
19
+ border-color 200ms;
11
20
 
12
21
  &:hover {
13
- background-color: #069;
22
+ color: colour.$tna-black;
23
+
24
+ background-color: #fff;
25
+
26
+ transition:
27
+ color 50ms,
28
+ background-color 50ms,
29
+ border-color 50ms;
14
30
  }
15
31
 
16
32
  &--secondary {
17
- color: #000;
33
+ color: colour.$tna-black;
34
+
35
+ background-color: colour.$tna-yellow;
18
36
 
19
- background-color: #ff0;
37
+ border-color: colour.$tna-yellow;
20
38
 
21
39
  &:hover {
22
- color: #fff;
40
+ color: colour.$tna-black;
41
+
42
+ border-color: colour.$tna-black;
23
43
  }
24
44
  }
25
45
  }
@@ -1,5 +1,4 @@
1
1
  import Button from "./template.njk";
2
- import "./_index.scss";
3
2
  import macroOptions from "./macro-options.json";
4
3
 
5
4
  const argTypes = {
@@ -13,12 +12,12 @@ const argTypes = {
13
12
 
14
13
  Object.keys(argTypes).forEach((argType) => {
15
14
  argTypes[argType].description = macroOptions.find(
16
- (option) => option.name === argType
15
+ (option) => option.name === argType,
17
16
  )?.description;
18
17
  });
19
18
 
20
19
  export default {
21
- title: "Components/Button",
20
+ title: "Components/Work in progress/Button",
22
21
  argTypes,
23
22
  };
24
23
 
@@ -7,7 +7,7 @@
7
7
  "text": "Log in",
8
8
  "href": "#"
9
9
  },
10
- "html": "<a href=\"#\" class=\"tna-button \">\n Log in\n</a>",
10
+ "html": "<a href=\"#\" class=\"tna-button \">\n Log in\n</a>",
11
11
  "hidden": false
12
12
  },
13
13
  {
@@ -17,7 +17,7 @@
17
17
  "href": "#",
18
18
  "title": "Log in to the service"
19
19
  },
20
- "html": "<a href=\"#\" class=\"tna-button \" title=\"Log in to the service\">\n Log in\n</a>",
20
+ "html": "<a href=\"#\" class=\"tna-button \" title=\"Log in to the service\">\n Log in\n</a>",
21
21
  "hidden": false
22
22
  },
23
23
  {
@@ -27,7 +27,7 @@
27
27
  "href": "#",
28
28
  "secondary": true
29
29
  },
30
- "html": "<a href=\"#\" class=\"tna-button tna-button--secondary\">\n Log in\n</a>",
30
+ "html": "<a href=\"#\" class=\"tna-button tna-button--secondary\">\n Log in\n</a>",
31
31
  "hidden": false
32
32
  },
33
33
  {
@@ -37,7 +37,7 @@
37
37
  "href": "#",
38
38
  "classes": "button__test-class"
39
39
  },
40
- "html": "<a href=\"#\" class=\"tna-button button__test-class\">\n Log in\n</a>",
40
+ "html": "<a href=\"#\" class=\"tna-button button__test-class\">\n Log in\n</a>",
41
41
  "hidden": false
42
42
  },
43
43
  {
@@ -49,7 +49,7 @@
49
49
  "data-testattribute": "foobar"
50
50
  }
51
51
  },
52
- "html": "<a href=\"#\" class=\"tna-button \" data-testattribute=\"foobar\">\n Log in\n</a>",
52
+ "html": "<a href=\"#\" class=\"tna-button \" data-testattribute=\"foobar\">\n Log in\n</a>",
53
53
  "hidden": false
54
54
  }
55
55
  ]
@@ -1,7 +1,7 @@
1
1
  {%- set buttonClasses = [params.classes] if params.classes else [] -%}
2
2
  {%- if params.secondary -%}
3
- {%- set buttonClasses = buttonClasses.concat('tna-button--secondary') -%}
3
+ {%- set buttonClasses = buttonClasses.concat('tna-button--secondary') -%}
4
4
  {%- endif -%}
5
- <a href="{{ params.href }}" class="tna-button {{ buttonClasses | join(' ') }}" {%- if params.title %} title="{{ params.title }}"{% endif %} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
6
- {{ params.text }}
5
+ <a href="{{ params.href }}" class="tna-button {{ buttonClasses | join(' ') }}"{%- if params.title %} title="{{ params.title }}"{% endif %} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
6
+ {{ params.text }}
7
7
  </a>
@@ -1,4 +1,4 @@
1
- @use "../../tools/typography" as typographyTools;
1
+ @use "../../variables/colour";
2
2
 
3
3
  .tna-card {
4
4
  &__inner {
@@ -48,7 +48,7 @@
48
48
  &--featured {
49
49
  position: relative;
50
50
 
51
- background-color: #ff0;
51
+ background-color: colour.$tna-yellow;
52
52
 
53
53
  .tna-card__inner {
54
54
  margin-left: 50%;
@@ -58,7 +58,11 @@
58
58
  .tna-card__heading {
59
59
  padding-bottom: 2rem;
60
60
 
61
- border-bottom: 2px #000 solid;
61
+ border-bottom: 2px colour.$tna-black solid;
62
+ }
63
+
64
+ .tna-card__title-link {
65
+ color: colour.$tna-black;
62
66
  }
63
67
 
64
68
  .tna-card__image-container {
@@ -1,5 +1,4 @@
1
1
  import Card from "./template.njk";
2
- import "./_index.scss";
3
2
  import macroOptions from "./macro-options.json";
4
3
 
5
4
  const argTypes = {
@@ -17,12 +16,12 @@ const argTypes = {
17
16
 
18
17
  Object.keys(argTypes).forEach((argType) => {
19
18
  argTypes[argType].description = macroOptions.find(
20
- (option) => option.name === argType
19
+ (option) => option.name === argType,
21
20
  )?.description;
22
21
  });
23
22
 
24
23
  export default {
25
- title: "Components/Card",
24
+ title: "Components/Work in progress/Card",
26
25
  argTypes,
27
26
  };
28
27
 
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "body": "<p>Card body</p>"
12
12
  },
13
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
13
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
14
14
  "hidden": false
15
15
  },
16
16
  {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "body": "<p>Card body</p>"
25
25
  },
26
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\">\n <p class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</p>\n <h3 class=\"tna-card__title tna-hgroup__title\">Card title</h3>\n </hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
26
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\">\n <p class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</p>\n <h3 class=\"tna-card__title tna-hgroup__title\">Card title</h3>\n </hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
27
27
  "hidden": false
28
28
  },
29
29
  {
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "body": "<p>Card body</p>"
39
39
  },
40
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\">\n <h3 class=\"tna-card__title tna-hgroup__title\">\n <span class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</span>Card title</h3>\n </hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
40
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\">\n <h3 class=\"tna-card__title tna-hgroup__title\">\n <span class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</span>Card title</h3>\n </hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
41
41
  "hidden": false
42
42
  },
43
43
  {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "body": "<p>Card body</p>"
52
52
  },
53
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
53
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
54
54
  "hidden": false
55
55
  },
56
56
  {
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "body": "<p>Card body</p>"
64
64
  },
65
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h1 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h1><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
65
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h1 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h1><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
66
66
  "hidden": false
67
67
  },
68
68
  {
@@ -75,7 +75,7 @@
75
75
  "href": "#",
76
76
  "body": "<p>Card body</p>"
77
77
  },
78
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\"><a href=\"#\" class=\"tna-card__title-link\">Card title</a></h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
78
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\"><a href=\"#\" class=\"tna-card__title-link\">Card title</a></h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
79
79
  "hidden": false
80
80
  },
81
81
  {
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "text": "Card body"
89
89
  },
90
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
90
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
91
91
  "hidden": false
92
92
  },
93
93
  {
@@ -103,7 +103,7 @@
103
103
  },
104
104
  "body": "<p>Card body</p>"
105
105
  },
106
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__image-container\">\n <img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" class=\"tna-card__image\" />\n </div><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
106
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__image-container\">\n <img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" class=\"tna-card__image\" />\n </div><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
107
107
  "hidden": false
108
108
  },
109
109
  {
@@ -122,7 +122,7 @@
122
122
  }
123
123
  ]
124
124
  },
125
- "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div><div class=\"tna-card__actions\"><a href=\"#\" class=\"tna-card__action tna-button\"title=\"Go and do the action\">Card action</a></div></div>\n</div>",
125
+ "html": "<div class=\"tna-card \">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div><div class=\"tna-card__actions\"><a href=\"#\" class=\"tna-card__action tna-button\"title=\"Go and do the action\">Card action</a></div></div>\n</div>",
126
126
  "hidden": false
127
127
  },
128
128
  {
@@ -135,7 +135,7 @@
135
135
  "body": "<p>Card body</p>",
136
136
  "classes": "card__test-class"
137
137
  },
138
- "html": "<div class=\"tna-card card__test-class\">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
138
+ "html": "<div class=\"tna-card card__test-class\">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
139
139
  "hidden": false
140
140
  },
141
141
  {
@@ -150,7 +150,7 @@
150
150
  "data-testattribute": "foobar"
151
151
  }
152
152
  },
153
- "html": "<div class=\"tna-card \" data-testattribute=\"foobar\">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
153
+ "html": "<div class=\"tna-card \" data-testattribute=\"foobar\">\n <div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div></div>\n</div>",
154
154
  "hidden": false
155
155
  }
156
156
  ]
@@ -2,61 +2,61 @@
2
2
  {%- set classes = [params.classes] if params.classes else [] -%}
3
3
  {%- set headingSize = params.heading.size if params.heading.size else "m" -%}
4
4
  {%- if params.featured -%}
5
- {%- set classes = classes.concat('tna-card--featured') -%}
5
+ {%- set classes = classes.concat('tna-card--featured') -%}
6
6
  {%- endif -%}
7
7
  <{{ htmlElement }} class="tna-card {{ classes | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
8
- <div class="tna-card__inner">
9
- {%- if params.heading.supertitle -%}
10
- {%- if params.heading.singleSentence -%}
11
- <hgroup class="tna-card__heading tna-hgroup tna-hgroup--{{ headingSize }}">
12
- <h{{ params.heading.level }} class="tna-card__title tna-hgroup__title">
13
- <span class="tna-card__supertitle tna-hgroup__supertitle">{{ params.heading.supertitle }}</span>
14
- {%- if params.href -%}
15
- <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
16
- {%- else -%}
17
- {{ params.heading.title }}
18
- {%- endif -%}
19
- </h{{ params.heading.level }}>
20
- </hgroup>
8
+ <div class="tna-card__inner">
9
+ {%- if params.heading.supertitle -%}
10
+ {%- if params.heading.singleSentence -%}
11
+ <hgroup class="tna-card__heading tna-hgroup tna-hgroup--{{ headingSize }}">
12
+ <h{{ params.heading.level }} class="tna-card__title tna-hgroup__title">
13
+ <span class="tna-card__supertitle tna-hgroup__supertitle">{{ params.heading.supertitle }}</span>
14
+ {%- if params.href -%}
15
+ <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
21
16
  {%- else -%}
22
- <hgroup class="tna-card__heading tna-hgroup tna-hgroup--{{ headingSize }}">
23
- <p class="tna-card__supertitle tna-hgroup__supertitle">{{ params.heading.supertitle }}</p>
24
- <h{{ params.heading.level }} class="tna-card__title tna-hgroup__title">
25
- {%- if params.href -%}
26
- <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
27
- {%- else -%}
28
- {{ params.heading.title }}
29
- {%- endif -%}
30
- </h{{ params.heading.level }}>
31
- </hgroup>
17
+ {{ params.heading.title }}
32
18
  {%- endif -%}
19
+ </h{{ params.heading.level }}>
20
+ </hgroup>
33
21
  {%- else -%}
34
- <h{{ params.heading.level }} class="tna-card__title tna-heading tna-heading--{{ headingSize }}">
22
+ <hgroup class="tna-card__heading tna-hgroup tna-hgroup--{{ headingSize }}">
23
+ <p class="tna-card__supertitle tna-hgroup__supertitle">{{ params.heading.supertitle }}</p>
24
+ <h{{ params.heading.level }} class="tna-card__title tna-hgroup__title">
35
25
  {%- if params.href -%}
36
- <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
26
+ <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
37
27
  {%- else -%}
38
- {{ params.heading.title }}
28
+ {{ params.heading.title }}
39
29
  {%- endif -%}
40
30
  </h{{ params.heading.level }}>
31
+ </hgroup>
41
32
  {%- endif -%}
42
- {%- if params.image -%}
43
- <div class="tna-card__image-container">
44
- <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" class="tna-card__image" />
45
- </div>
33
+ {%- else -%}
34
+ <h{{ params.heading.level }} class="tna-card__title tna-heading tna-heading--{{ headingSize }}">
35
+ {%- if params.href -%}
36
+ <a href="{{ params.href }}" class="tna-card__title-link">{{ params.heading.title }}</a>
37
+ {%- else -%}
38
+ {{ params.heading.title }}
46
39
  {%- endif -%}
47
- <div class="tna-card__body">
48
- {%- if params.text -%}
49
- <p>{{ params.text }}</p>
50
- {%- else -%}
51
- {{ params.body | safe }}
52
- {%- endif -%}
53
- </div>
54
- {%- if params.actions -%}
55
- <div class="tna-card__actions">
56
- {%- for item in params.actions -%}
57
- <a href="{{ item.href }}" class="tna-card__action tna-button" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
58
- {%- endfor -%}
59
- </div>
40
+ </h{{ params.heading.level }}>
41
+ {%- endif -%}
42
+ {%- if params.image -%}
43
+ <div class="tna-card__image-container">
44
+ <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" class="tna-card__image" />
45
+ </div>
46
+ {%- endif -%}
47
+ <div class="tna-card__body">
48
+ {%- if params.text -%}
49
+ <p>{{ params.text }}</p>
50
+ {%- else -%}
51
+ {{ params.body | safe }}
60
52
  {%- endif -%}
61
53
  </div>
54
+ {%- if params.actions -%}
55
+ <div class="tna-card__actions">
56
+ {%- for item in params.actions -%}
57
+ <a href="{{ item.href }}" class="tna-card__action tna-button" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
58
+ {%- endfor -%}
59
+ </div>
60
+ {%- endif -%}
61
+ </div>
62
62
  </{{ htmlElement }}>
@@ -0,0 +1,49 @@
1
+ .tna-filters {
2
+ &__item {
3
+ margin: 0 0.75rem 0.75rem 0;
4
+
5
+ display: inline-block;
6
+
7
+ &:last-child {
8
+ margin-right: 0;
9
+ margin-bottom: 0;
10
+ }
11
+ }
12
+
13
+ &--stacked &__item {
14
+ display: block;
15
+ }
16
+
17
+ &__item--selected #{&}__link {
18
+ color: #fff;
19
+
20
+ background-color: #004c7e;
21
+ }
22
+
23
+ &__link {
24
+ padding: 0.125rem 0.75rem;
25
+
26
+ display: inline-block;
27
+
28
+ color: #000;
29
+ text-decoration: none;
30
+
31
+ background-color: #d4e5ef;
32
+
33
+ border-radius: 99rem;
34
+
35
+ transition:
36
+ color 200ms,
37
+ background-color 200ms;
38
+
39
+ &:hover {
40
+ color: #fff;
41
+
42
+ background-color: #004c7e;
43
+
44
+ transition:
45
+ color 50ms,
46
+ background-color 50ms;
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,75 @@
1
+ import Filters from "./template.njk";
2
+ import macroOptions from "./macro-options.json";
3
+
4
+ const argTypes = {
5
+ items: { control: "object" },
6
+ stack: { control: "boolean" },
7
+ classes: { control: "text" },
8
+ attributes: { control: "object" },
9
+ };
10
+
11
+ Object.keys(argTypes).forEach((argType) => {
12
+ argTypes[argType].description = macroOptions.find(
13
+ (option) => option.name === argType,
14
+ )?.description;
15
+ });
16
+
17
+ export default {
18
+ title: "Components/Experimental/Filters",
19
+ argTypes,
20
+ };
21
+
22
+ const Template = ({ items, stack, classes, attributes }) => {
23
+ return Filters({
24
+ params: {
25
+ items,
26
+ stack,
27
+ classes,
28
+ attributes,
29
+ },
30
+ });
31
+ };
32
+
33
+ export const Standard = Template.bind({});
34
+ Standard.args = {
35
+ items: [
36
+ {
37
+ label: "All",
38
+ href: "#?filter=all",
39
+ selected: true,
40
+ },
41
+ {
42
+ label: "Medieval (974—1485)",
43
+ href: "#?filter=alpha",
44
+ },
45
+ {
46
+ label: "Early Modern (1485—1714)",
47
+ href: "#?filter=beta",
48
+ },
49
+ {
50
+ label: "Georgians (1714—1837)",
51
+ href: "#?filter=gamma",
52
+ },
53
+ {
54
+ label: "Victorians (1837—1901)",
55
+ href: "#?filter=delta",
56
+ },
57
+ {
58
+ label: "Early 20th century (1901—1918)",
59
+ href: "#?filter=epsilon",
60
+ },
61
+ {
62
+ label: "Interwar (1918—1939)",
63
+ href: "#?filter=zeta",
64
+ },
65
+ {
66
+ label: "Second World War (1939—1945)",
67
+ href: "#?filter=eta",
68
+ },
69
+ {
70
+ label: "Postwar (1945—2000)",
71
+ href: "#?filter=theta",
72
+ },
73
+ ],
74
+ classes: "tna-filters--demo",
75
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": "filters",
3
+ "fixtures": []
4
+ }
@@ -0,0 +1,52 @@
1
+ [
2
+ {
3
+ "name": "items",
4
+ "type": "array",
5
+ "required": true,
6
+ "description": "",
7
+ "params": [
8
+ {
9
+ "name": "label",
10
+ "type": "string",
11
+ "required": true,
12
+ "description": ""
13
+ },
14
+ {
15
+ "name": "href",
16
+ "type": "string",
17
+ "required": true,
18
+ "description": ""
19
+ },
20
+ {
21
+ "name": "title",
22
+ "type": "string",
23
+ "required": false,
24
+ "description": ""
25
+ },
26
+ {
27
+ "name": "selected",
28
+ "type": "boolean",
29
+ "required": false,
30
+ "description": ""
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ "name": "stack",
36
+ "type": "boolean",
37
+ "required": false,
38
+ "description": ""
39
+ },
40
+ {
41
+ "name": "classes",
42
+ "type": "string",
43
+ "required": false,
44
+ "description": "Classes to add to the filters."
45
+ },
46
+ {
47
+ "name": "attributes",
48
+ "type": "object",
49
+ "required": false,
50
+ "description": "HTML attributes (for example data attributes) to add to the filters."
51
+ }
52
+ ]
@@ -0,0 +1,3 @@
1
+ {% macro tnaFilters(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,8 @@
1
+ {%- set classes = [params.classes] if params.classes else [] -%}
2
+ <ul class="tna-filters{% if params.stack %} tna-filters--stacked{% endif %} tna-ul tna-ul--plain {{ classes | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
3
+ {%- for item in params.items -%}
4
+ <li class="tna-filters__item{%- if item.selected %} tna-filters__item--selected{% endif %}">
5
+ <a href="{{ item.href }}"{%- if item.title %} title="{{ item.title }}"{% endif %} class="tna-filters__link">{{ item.label }}</a>
6
+ </li>
7
+ {%- endfor -%}
8
+ </ul>