@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
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "name": "heading",
4
+ "type": "string",
5
+ "required": false,
6
+ "description": ""
7
+ },
8
+ {
9
+ "name": "body",
10
+ "type": "string",
11
+ "required": false,
12
+ "description": ""
13
+ },
14
+ {
15
+ "name": "text",
16
+ "type": "string",
17
+ "required": false,
18
+ "description": ""
19
+ },
20
+ {
21
+ "name": "image",
22
+ "type": "object",
23
+ "required": false,
24
+ "description": "",
25
+ "params": [
26
+ {
27
+ "name": "src",
28
+ "type": "string",
29
+ "required": true,
30
+ "description": ""
31
+ },
32
+ {
33
+ "name": "alt",
34
+ "type": "string",
35
+ "required": true,
36
+ "description": ""
37
+ },
38
+ {
39
+ "name": "information",
40
+ "type": "string",
41
+ "required": false,
42
+ "description": ""
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "name": "classes",
48
+ "type": "string",
49
+ "required": false,
50
+ "description": "Classes to add to the card."
51
+ },
52
+ {
53
+ "name": "attributes",
54
+ "type": "object",
55
+ "required": false,
56
+ "description": "HTML attributes (for example data attributes) to add to the card."
57
+ }
58
+ ]
@@ -0,0 +1,3 @@
1
+ {% macro tnaHero(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,32 @@
1
+ {%- set classes = [params.classes] if params.classes else [] -%}
2
+ <header class="tna-hero {{ classes | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
3
+ <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" class="tna-hero__image">
4
+ {%- if params.image.information -%}
5
+ <details class="tna-hero__image-details">
6
+ <summary class="tna-hero__image-details-summary">
7
+ <span class="tna-hero__image-details-summary-icon">I</span>nformation about this image
8
+ </summary>
9
+ <div class="tna-hero__image-information">
10
+ <p>{{ params.image.information }}</p>
11
+ </div>
12
+ </details>
13
+ {%- endif -%}
14
+ <div class="tna-container tna-hero__inner">
15
+ <div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny tna-hero__content">
16
+ <div class="tna-hero__content-inner">
17
+ {%- if params.heading -%}
18
+ <h1 class="tna-heading tna-heading--xl tna-hero__heading">
19
+ {{ params.heading }}
20
+ </h1>
21
+ {%- endif -%}
22
+ <div class="tna-hero__body">
23
+ {%- if params.text -%}
24
+ <p>{{ params.text }}</p>
25
+ {%- elseif params.body -%}
26
+ {{ params.body | safe }}
27
+ {%- endif -%}
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </header>
@@ -1,81 +1,77 @@
1
1
  @use "../../tools/typography" as typographyTools;
2
2
 
3
3
  .tna-sensitive-image {
4
- }
5
-
6
- .tna-sensitive-image__warning {
7
- }
4
+ &__warning {
5
+ }
8
6
 
9
- .tna-sensitive-image__details {
10
- position: relative;
7
+ &__details {
8
+ position: relative;
11
9
 
12
- // overflow: hidden;
10
+ // overflow: hidden;
13
11
 
14
- &::after {
15
- width: 100%;
16
- padding-bottom: calc(
17
- 100% * var(--sensitive-image-height) / var(--sensitive-image-width)
18
- );
12
+ &::after {
13
+ width: 100%;
14
+ padding-bottom: calc(
15
+ 100% * var(--sensitive-image-height) / var(--sensitive-image-width)
16
+ );
19
17
 
20
- display: block;
18
+ display: block;
21
19
 
22
- position: relative;
23
- z-index: -1;
20
+ position: relative;
21
+ z-index: -1;
24
22
 
25
- background-image: var(--sensitive-image);
26
- background-clip: padding-box;
27
- background-size: contain;
23
+ background-image: var(--sensitive-image);
24
+ background-clip: padding-box;
25
+ background-size: contain;
28
26
 
29
- filter: blur(20px) saturate(0);
27
+ filter: blur(20px) saturate(0);
30
28
 
31
- content: "";
29
+ content: "";
30
+ }
32
31
  }
33
- }
34
32
 
35
- .tna-sensitive-image__show {
36
- display: flex;
37
- align-items: center;
38
- justify-content: center;
33
+ &__show {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
39
37
 
40
- position: absolute;
41
- top: 0;
42
- right: 0;
43
- bottom: 0;
44
- left: 0;
45
- z-index: 1;
38
+ position: absolute;
39
+ inset: 0;
40
+ z-index: 1;
46
41
 
47
- font-size: 0;
42
+ font-size: 0;
48
43
 
49
- cursor: pointer;
44
+ cursor: pointer;
50
45
 
51
- &::after {
52
- padding: 0.5rem 2rem;
46
+ &::after {
47
+ padding: 0.5rem 2rem;
53
48
 
54
- @include typographyTools.relativeFontSize(16);
55
- background-color: #ff0;
49
+ @include typographyTools.relative-font-size(16);
50
+ background-color: #ff0;
56
51
 
57
- content: attr(data-action);
58
- }
52
+ content: attr(data-action);
53
+ }
59
54
 
60
- &:hover {
61
- &::after {
62
- color: #fff;
55
+ &:hover {
56
+ &::after {
57
+ color: #fff;
63
58
 
64
- background-color: #000;
59
+ background-color: #000;
60
+ }
65
61
  }
66
62
  }
67
- }
68
63
 
69
- .tna-sensitive-image__container {
70
- }
64
+ &__container {
65
+ }
71
66
 
72
- .tna-sensitive-image__image {
73
- width: 100%;
74
- }
67
+ &__image {
68
+ width: 100%;
69
+ }
75
70
 
76
- .tna-sensitive-image__details[open] {
77
- &::after,
78
- .tna-sensitive-image__show {
79
- display: none;
71
+ &__details[open] {
72
+ &::after,
73
+ .tna-sensitive-image__show {
74
+ display: none;
75
+ }
80
76
  }
81
77
  }
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():(e.TNAFrontend=e.TNAFrontend||{},e.TNAFrontend["components/sensitive-image/sensitive-image"]=t())}(self,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function i(e){this.$module=e,this.$imageDetails=e&&e.querySelector(".tna-sensitive-image__details"),this.$image=e&&e.querySelector(".tna-sensitive-image__image"),this.imageIsVisible=!1}e.r(t),e.d(t,{default:()=>o}),i.prototype.init=function(){console.log(this),this.$module&&this.$imageDetails&&this.$image&&this.$imageDetails.addEventListener("toggle",this.handleImageDetailsToggle.bind(this))},i.prototype.handleImageDetailsToggle=function(e){this.$imageDetails.hasAttribute("open")&&this.$image.focus({preventScroll:!0,focusVisible:!0})};const o=i;return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():(e.TNAFrontend=e.TNAFrontend||{},e.TNAFrontend["components/sensitive-image/sensitive-image"]=t())}(self,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function i(e){this.$module=e,this.$imageDetails=e&&e.querySelector(".tna-sensitive-image__details"),this.$image=e&&e.querySelector(".tna-sensitive-image__image"),this.imageIsVisible=!1}e.r(t),e.d(t,{default:()=>o}),i.prototype.init=function(){console.log(this),this.$module&&this.$imageDetails&&this.$image&&this.$imageDetails.addEventListener("toggle",this.handleImageDetailsToggle.bind(this))},i.prototype.handleImageDetailsToggle=function(){this.$imageDetails.hasAttribute("open")&&this.$image.focus({preventScroll:!0,focusVisible:!0})};const o=i;return t})()));
2
2
  //# sourceMappingURL=sensitive-image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/sensitive-image/sensitive-image.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,8CAAgDC,IACtH,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,KCL9D,SAASC,EAAeC,GACtBC,KAAKD,QAAUA,EACfC,KAAKC,cACHF,GAAWA,EAAQG,cAAc,iCACnCF,KAAKG,OAASJ,GAAWA,EAAQG,cAAc,+BAC/CF,KAAKI,gBAAiB,CACxB,C,8BAEAN,EAAeN,UAAUa,KAAO,WAC9BC,QAAQC,IAAIP,MACPA,KAAKD,SAAYC,KAAKC,eAAkBD,KAAKG,QAGlDH,KAAKC,cAAcO,iBACjB,SACAR,KAAKS,yBAAyBC,KAAKV,MAEvC,EAEAF,EAAeN,UAAUiB,yBAA2B,SAAUE,GACxDX,KAAKC,cAAcW,aAAa,SAClCZ,KAAKG,OAAOU,MAAM,CAAEC,eAAe,EAAMC,cAAc,GAE3D,EAEA,U","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/sensitive-image/sensitive-image.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/sensitive-image/sensitive-image\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","function SensitiveImage($module) {\n this.$module = $module;\n this.$imageDetails =\n $module && $module.querySelector(\".tna-sensitive-image__details\");\n this.$image = $module && $module.querySelector(\".tna-sensitive-image__image\");\n this.imageIsVisible = false;\n}\n\nSensitiveImage.prototype.init = function () {\n console.log(this);\n if (!this.$module || !this.$imageDetails || !this.$image) {\n return;\n }\n this.$imageDetails.addEventListener(\n \"toggle\",\n this.handleImageDetailsToggle.bind(this)\n );\n};\n\nSensitiveImage.prototype.handleImageDetailsToggle = function (e) {\n if (this.$imageDetails.hasAttribute(\"open\")) {\n this.$image.focus({ preventScroll: true, focusVisible: true });\n }\n};\n\nexport default SensitiveImage;\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","SensitiveImage","$module","this","$imageDetails","querySelector","$image","imageIsVisible","init","console","log","addEventListener","handleImageDetailsToggle","bind","e","hasAttribute","focus","preventScroll","focusVisible"],"sourceRoot":""}
1
+ {"version":3,"file":"components/sensitive-image/sensitive-image.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,8CAAgDC,IACtH,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,KCL9D,SAASC,EAAeC,GACtBC,KAAKD,QAAUA,EACfC,KAAKC,cACHF,GAAWA,EAAQG,cAAc,iCACnCF,KAAKG,OAASJ,GAAWA,EAAQG,cAAc,+BAC/CF,KAAKI,gBAAiB,CACxB,C,8BAEAN,EAAeN,UAAUa,KAAO,WAC9BC,QAAQC,IAAIP,MACPA,KAAKD,SAAYC,KAAKC,eAAkBD,KAAKG,QAGlDH,KAAKC,cAAcO,iBACjB,SACAR,KAAKS,yBAAyBC,KAAKV,MAEvC,EAEAF,EAAeN,UAAUiB,yBAA2B,WAC9CT,KAAKC,cAAcU,aAAa,SAClCX,KAAKG,OAAOS,MAAM,CAAEC,eAAe,EAAMC,cAAc,GAE3D,EAEA,U","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/sensitive-image/sensitive-image.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/sensitive-image/sensitive-image\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","function SensitiveImage($module) {\n this.$module = $module;\n this.$imageDetails =\n $module && $module.querySelector(\".tna-sensitive-image__details\");\n this.$image = $module && $module.querySelector(\".tna-sensitive-image__image\");\n this.imageIsVisible = false;\n}\n\nSensitiveImage.prototype.init = function () {\n console.log(this);\n if (!this.$module || !this.$imageDetails || !this.$image) {\n return;\n }\n this.$imageDetails.addEventListener(\n \"toggle\",\n this.handleImageDetailsToggle.bind(this)\n );\n};\n\nSensitiveImage.prototype.handleImageDetailsToggle = function () {\n if (this.$imageDetails.hasAttribute(\"open\")) {\n this.$image.focus({ preventScroll: true, focusVisible: true });\n }\n};\n\nexport default SensitiveImage;\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","SensitiveImage","$module","this","$imageDetails","querySelector","$image","imageIsVisible","init","console","log","addEventListener","handleImageDetailsToggle","bind","hasAttribute","focus","preventScroll","focusVisible"],"sourceRoot":""}
@@ -17,7 +17,7 @@ SensitiveImage.prototype.init = function () {
17
17
  );
18
18
  };
19
19
 
20
- SensitiveImage.prototype.handleImageDetailsToggle = function (e) {
20
+ SensitiveImage.prototype.handleImageDetailsToggle = function () {
21
21
  if (this.$imageDetails.hasAttribute("open")) {
22
22
  this.$image.focus({ preventScroll: true, focusVisible: true });
23
23
  }
@@ -1,6 +1,8 @@
1
1
  import SensitiveImage from "./template.njk";
2
2
  import "./_index.scss";
3
3
  import macroOptions from "./macro-options.json";
4
+ import { expect } from "@storybook/jest";
5
+ import { within, userEvent } from "@storybook/testing-library";
4
6
 
5
7
  const argTypes = {
6
8
  src: { control: "text" },
@@ -8,7 +10,7 @@ const argTypes = {
8
10
  warning: { control: "text" },
9
11
  action: { control: "text" },
10
12
  classes: { control: "text" },
11
- attributes: { control: "text" },
13
+ attributes: { control: "object" },
12
14
  };
13
15
 
14
16
  Object.keys(argTypes).forEach((argType) => {
@@ -45,4 +47,38 @@ Standard.args = {
45
47
  warning: "This is a gory photo",
46
48
  action: "Show me the gory photo",
47
49
  classes: "tna-sensitive-image--demo",
50
+ attributes: {
51
+ "data-testid": "sensitive-image-test",
52
+ },
53
+ };
54
+
55
+ export const Test = Template.bind({});
56
+ Test.args = {
57
+ image: {
58
+ src: "https://picsum.photos/id/237/800/600",
59
+ alt: "A placeholder image",
60
+ width: 800,
61
+ height: 600,
62
+ },
63
+ warning: "This is a gory photo",
64
+ action: "Show me the gory photo",
65
+ classes: "tna-sensitive-image--demo",
66
+ attributes: {
67
+ "data-testid": "sensitive-image-test",
68
+ },
69
+ };
70
+
71
+ Test.play = async ({ args, canvasElement }) => {
72
+ const canvas = within(canvasElement);
73
+
74
+ const image = canvas.getByAltText(args.image.alt);
75
+ await expect(image).not.toBeVisible();
76
+ const warning = canvas.getByText(args.warning);
77
+ await expect(warning).toBeVisible();
78
+ const summaryOpen = canvas.getByText(args.action);
79
+ await expect(summaryOpen).toBeVisible();
80
+
81
+ await userEvent.click(summaryOpen);
82
+ await expect(image).toBeVisible();
83
+ await expect(warning).toBeVisible();
48
84
  };
@@ -15,7 +15,7 @@ TNA needed a frontend toolkit that was:
15
15
  - progressively enhanced - all components should still be operable without JavaScript, CSS or both
16
16
  - importable into projects (via a service such as [NPM](https://www.npmjs.com/search?q=nationalarchives)) - to make dependency management as simple as possible
17
17
  - agnostic - the implementation for the markup of the components can be replicated in any required technology (because we have Python, PHP and Java applications throughout the organisation)
18
- - testable - both from an internal perspective as well as providing scenarios and expected results for language implimentations to be able to validate against
18
+ - testable - both from an internal perspective as well as providing scenarios and expected results for language implementations to be able to validate against
19
19
  - lean - minimal reliance on other languages and dependencies to ensure good extendability and speed of development and deployment
20
20
  - automatically published - leveraging CI/CD, creating a new release version should be as simple as possible
21
21
 
@@ -9,6 +9,7 @@ import { Meta } from "@storybook/blocks";
9
9
  1. Run `nvm use` to ensure the correct Node version is used
10
10
  1. Run `npm install` to update the `package-lock.json`
11
11
  1. Merge all changes to `main` via a pull request
12
+ 1. Wait for the CI to pass
12
13
  1. Tag the version with `git tag v1.0.0` (ensure leading `v` and change version number as necessary)
13
14
  1. Push the new tag with `git push origin --tags`
14
15
  1. Create a [new release on GitHub](https://github.com/nationalarchives/tna-frontend/releases/new) using the tag you just created
@@ -1,6 +1,6 @@
1
1
  {% from "nationalarchives/components/card/macro.njk" import tnaCard %}
2
2
 
3
- {% extends "layouts/_generic.njk" %}
3
+ {% extends "nationalarchives/templates/layouts/_generic.njk" %}
4
4
 
5
5
  {% block pageTitle %}The National Archives | Welcome{% endblock %}
6
6
 
@@ -36,7 +36,7 @@
36
36
  "htmlElement": "article"
37
37
  }) }}
38
38
  </div>
39
- {% for item in range(0, 12) -%}
39
+ {% for item in range(0, 6) -%}
40
40
  <div class="tna-column tna-column--width-1-3 tna-column--width-1-2-medium tna-column--full-small tna-column--full-tiny">
41
41
  {{ tnaCard({
42
42
  "heading": {
@@ -0,0 +1,38 @@
1
+ {% from "nationalarchives/components/card/macro.njk" import tnaCard %}
2
+
3
+ {% extends "nationalarchives/templates/layouts/_generic.njk" %}
4
+
5
+ {% block pageTitle %}The National Archives | Results{% endblock %}
6
+
7
+ {% block main %}
8
+ <div class="tna-container">
9
+ <div class="tna-column tna-column--1-4 tna-column--width-1-3-medium tna-column--full-small tna-column--full-tiny">
10
+ <h2>Search filters...</h2>
11
+ </div>
12
+ <main class="tna-main-wrapper tna-column tna-column--container tna-column--3-4 tna-column--width-2-3-medium tna-column--full-small tna-column--full-tiny {{ mainClasses }}" id="main-content" role="main"{% if mainLang %} lang="{{ mainLang }}"{% endif %}>
13
+ {% block beforeContent %}{% endblock %}
14
+ <div class="tna-column tna-column--full">
15
+ <h1 class="tna-heading tna-heading--xl">
16
+ Search results for "foobar"
17
+ </h1>
18
+ </div>
19
+ {% for item in range(0, 6) -%}
20
+ <div class="tna-column tna-column--width-1-2 tna-column--width-full-small tna-column--width-full-tiny">
21
+ {{ tnaCard({
22
+ "heading": {
23
+ "supertitle": "Card supertitle",
24
+ "title": "Card title",
25
+ "level": 2
26
+ },
27
+ "href": "#",
28
+ "image": {
29
+ "src": "https://loremflickr.com/640/360",
30
+ "alt": "A placeholder image"
31
+ },
32
+ "body": "<p>Card body</p>",
33
+ }) }}
34
+ </div>
35
+ {%- endfor %}
36
+ </main>
37
+ </div>
38
+ {% endblock %}
@@ -0,0 +1,42 @@
1
+ {% from "nationalarchives/components/card/macro.njk" import tnaCard %}
2
+ {% from "nationalarchives/components/hero/macro.njk" import tnaHero %}
3
+
4
+ {% extends "nationalarchives/templates/layouts/_generic.njk" %}
5
+
6
+ {% block pageTitle %}The National Archives | Topics{% endblock %}
7
+
8
+ {% block main %}
9
+ <main class="tna-main-wrapper">
10
+ {{ tnaHero({
11
+ "heading": "Title",
12
+ "body": "<p>Body</p>",
13
+ "image": {
14
+ "src": "https://picsum.photos/id/29/640/360",
15
+ "alt": "A placeholder image",
16
+ "information": "Photo of some mountains by a famous photographer, ©2012"
17
+ }
18
+ }) }}
19
+ <div class="tna-container">
20
+ <div class="tna-column tna-column--full">
21
+ <h2>Topic title</h2>
22
+ </div>
23
+ {% for item in range(0, 6) -%}
24
+ <div class="tna-column tna-column--width-1-3 tna-column--width-1-2-medium tna-column--width-full-small tna-column--width-full-tiny">
25
+ {{ tnaCard({
26
+ "heading": {
27
+ "supertitle": "Card supertitle",
28
+ "title": "Card title",
29
+ "level": 3
30
+ },
31
+ "href": "#",
32
+ "image": {
33
+ "src": "https://loremflickr.com/640/360",
34
+ "alt": "A placeholder image"
35
+ },
36
+ "body": "<p>Card body</p>",
37
+ }) }}
38
+ </div>
39
+ {%- endfor %}
40
+ </div>
41
+ </main>
42
+ {% endblock %}
@@ -1,2 +1,3 @@
1
1
  @use "grid";
2
+ @use "media";
2
3
  @use "typography";
@@ -3,11 +3,11 @@
3
3
 
4
4
  @mixin columns-generator($count, $suffix: "") {
5
5
  @for $i from 1 through $count - 1 {
6
- $simplestFractionFound: false;
6
+ $simplest-fraction-found: false;
7
7
 
8
8
  @for $j from math.div($count, 2) through 1 {
9
9
  @if (
10
- $count % $j == 0 and $i % $j == 0 and $simplestFractionFound != true
10
+ $count % $j == 0 and $i % $j == 0 and $simplest-fraction-found != true
11
11
  ) {
12
12
  .tna-column--width-#{math.div($i, $j)}-#{math.div($count, $j)}#{$suffix} {
13
13
  width: math.div(100%, $count) * $i;
@@ -22,11 +22,11 @@
22
22
  // margin-left: math.div(100%, $count) * $i;
23
23
  // }
24
24
 
25
- $simplestFractionFound: true;
25
+ $simplest-fraction-found: true;
26
26
  }
27
27
  }
28
28
 
29
- @if ($simplestFractionFound != true) {
29
+ @if $simplest-fraction-found != true {
30
30
  .tna-column--width-#{$i}-#{$count}#{$suffix} {
31
31
  width: math.div(100%, $count) * $i;
32
32
  flex: none;
@@ -0,0 +1,62 @@
1
+ @use "../variables/media";
2
+
3
+ // 0 ============= 480 ===== 768 == 1024 ==========================
4
+ // | | | |
5
+ // | TINY | SMALL | MED | LARGE
6
+ // | | | |
7
+ // |<------------->| . . on-tiny
8
+ // |<----------------------->| . on-mobile
9
+ // |<------------------------------>| on-smaller-than-large
10
+ // . |<------->| . on-small
11
+ // . |<------------------------- on-larger-than-tiny
12
+ // . . |<---->| on-medium
13
+ // . . |<--------------- on-larger-than-mobile
14
+ // . . . |<-------- on-large
15
+
16
+ @mixin on-large() {
17
+ @media #{media.$media-large} {
18
+ @content;
19
+ }
20
+ }
21
+
22
+ @mixin on-medium() {
23
+ @media #{media.$media-medium} {
24
+ @content;
25
+ }
26
+ }
27
+
28
+ @mixin on-small() {
29
+ @media #{media.$media-small} {
30
+ @content;
31
+ }
32
+ }
33
+
34
+ @mixin on-tiny() {
35
+ @media #{media.$media-tiny} {
36
+ @content;
37
+ }
38
+ }
39
+
40
+ @mixin on-larger-than-mobile() {
41
+ @media #{media.$media-gt-mobile} {
42
+ @content;
43
+ }
44
+ }
45
+
46
+ @mixin on-larger-than-tiny() {
47
+ @media #{media.$media-gt-tiny} {
48
+ @content;
49
+ }
50
+ }
51
+
52
+ @mixin on-smaller-than-large() {
53
+ @media #{media.$media-lt-large} {
54
+ @content;
55
+ }
56
+ }
57
+
58
+ @mixin on-mobile() {
59
+ @media #{media.$media-mobile} {
60
+ @content;
61
+ }
62
+ }
@@ -1,6 +1,6 @@
1
1
  @use "sass:math";
2
2
  @use "../variables/typography";
3
3
 
4
- @mixin relativeFontSize($fontSizePx) {
5
- font-size: #{math.div($fontSizePx, typography.$baseFontSizePx)}rem;
4
+ @mixin relative-font-size($fontSizePx) {
5
+ font-size: #{math.div($fontSizePx, typography.$base-font-size-px)}rem;
6
6
  }
@@ -9,7 +9,7 @@
9
9
  overflow-y: auto;
10
10
  -webkit-overflow-scrolling: touch;
11
11
 
12
- font-size: typography.$baseFontSizePx;
12
+ font-size: typography.$base-font-size-px;
13
13
 
14
14
  @media (prefers-reduced-motion) {
15
15
  * {