@nationalarchives/frontend 0.1.10-prerelease → 0.1.11-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.
- package/README.md +1 -1
- package/govuk-prototype-kit.config.json +0 -3
- package/nationalarchives/_features.scss +3 -0
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +24 -8
- package/nationalarchives/all.scss +8 -4
- package/nationalarchives/assets/images/tna-square-logo.svg +5 -24
- package/nationalarchives/components/_index.scss +13 -0
- package/nationalarchives/components/breadcrumbs/_index.scss +28 -7
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
- package/nationalarchives/components/breadcrumbs/macro.njk +1 -1
- package/nationalarchives/components/breadcrumbs/template.njk +14 -13
- package/nationalarchives/components/button/_index.scss +23 -11
- package/nationalarchives/components/button/button.stories.js +1 -1
- package/nationalarchives/components/button/fixtures.json +5 -5
- package/nationalarchives/components/button/macro.njk +1 -1
- package/nationalarchives/components/card/_index.scss +51 -7
- package/nationalarchives/components/card/card.js +2 -0
- package/nationalarchives/components/card/card.js.map +1 -0
- package/nationalarchives/components/card/card.mjs +45 -0
- package/nationalarchives/components/card/card.stories.js +18 -14
- package/nationalarchives/components/card/fixtures.json +14 -12
- package/nationalarchives/components/card/macro-options.json +18 -0
- package/nationalarchives/components/card/macro.njk +1 -1
- package/nationalarchives/components/card/template.njk +9 -4
- package/nationalarchives/components/filters/filters.stories.js +1 -1
- package/nationalarchives/components/filters/macro.njk +1 -1
- package/nationalarchives/components/filters/template.njk +2 -2
- package/nationalarchives/components/footer/_index.scss +24 -12
- package/nationalarchives/components/footer/fixtures.json +1 -1
- package/nationalarchives/components/footer/footer.stories.js +7 -7
- package/nationalarchives/components/footer/macro.njk +1 -1
- package/nationalarchives/components/footer/template.njk +4 -4
- package/nationalarchives/components/grid/_index.scss +10 -12
- package/nationalarchives/components/grid/fixtures.json +12 -12
- package/nationalarchives/components/grid/grid.stories.js +55 -1
- package/nationalarchives/components/grid/macro-options.json +30 -0
- package/nationalarchives/components/grid/macro.njk +1 -1
- package/nationalarchives/components/grid/template.njk +17 -1
- package/nationalarchives/components/header/_index.scss +103 -38
- package/nationalarchives/components/header/header.js +1 -1
- package/nationalarchives/components/header/header.js.map +1 -1
- package/nationalarchives/components/header/header.mjs +1 -12
- package/nationalarchives/components/header/header.stories.js +143 -2
- package/nationalarchives/components/header/macro-options.json +26 -0
- package/nationalarchives/components/header/macro.njk +1 -1
- package/nationalarchives/components/header/template.njk +27 -30
- package/nationalarchives/components/hero/_index.scss +33 -6
- package/nationalarchives/components/hero/fixtures.json +16 -1
- package/nationalarchives/components/hero/hero.stories.js +17 -3
- package/nationalarchives/components/hero/macro-options.json +13 -1
- package/nationalarchives/components/hero/macro.njk +1 -1
- package/nationalarchives/components/hero/template.njk +7 -5
- package/nationalarchives/components/phase-banner/_index.scss +17 -0
- package/nationalarchives/components/phase-banner/fixtures.json +69 -2
- package/nationalarchives/components/phase-banner/macro.njk +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +32 -6
- package/nationalarchives/components/phase-banner/template.njk +4 -4
- package/nationalarchives/components/picture/_index.scss +77 -0
- package/nationalarchives/components/picture/fixtures.json +4 -0
- package/nationalarchives/components/picture/macro-options.json +88 -0
- package/nationalarchives/components/picture/macro.njk +3 -0
- package/nationalarchives/components/picture/picture.js +2 -0
- package/nationalarchives/components/picture/picture.js.map +1 -0
- package/nationalarchives/components/picture/picture.mjs +57 -0
- package/nationalarchives/components/picture/picture.stories.js +63 -0
- package/nationalarchives/components/picture/template.njk +42 -0
- package/nationalarchives/components/profile/_index.scss +2 -0
- package/nationalarchives/components/profile/fixtures.json +4 -0
- package/nationalarchives/components/profile/macro-options.json +14 -0
- package/nationalarchives/components/profile/macro.njk +3 -0
- package/nationalarchives/components/profile/profile.stories.js +32 -0
- package/nationalarchives/components/profile/template.njk +15 -0
- package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
- package/nationalarchives/components/sensitive-image/macro.njk +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +1 -1
- package/nationalarchives/components/tabs/_index.scss +148 -0
- package/nationalarchives/components/tabs/fixtures.json +4 -0
- package/nationalarchives/components/tabs/macro-options.json +52 -0
- package/nationalarchives/components/tabs/macro.njk +3 -0
- package/nationalarchives/components/tabs/tabs.js +2 -0
- package/nationalarchives/components/tabs/tabs.js.map +1 -0
- package/nationalarchives/components/tabs/tabs.mjs +214 -0
- package/nationalarchives/components/tabs/tabs.stories.js +302 -0
- package/nationalarchives/components/tabs/template.njk +20 -0
- package/nationalarchives/patterns/_index.scss +1 -0
- package/nationalarchives/patterns/featured-collection/_index.scss +13 -0
- package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +35 -0
- package/nationalarchives/patterns/featured-collection/macro-options.json +20 -0
- package/nationalarchives/patterns/featured-collection/macro.njk +3 -0
- package/nationalarchives/patterns/featured-collection/template.njk +96 -0
- package/nationalarchives/stories/development/contributing.mdx +2 -1
- package/nationalarchives/stories/utilities/colour.stories.js +189 -0
- package/nationalarchives/stories/utilities/typography.mdx +1 -0
- package/nationalarchives/stories/utilities/typography.stories.js +15 -0
- package/nationalarchives/templates/layouts/_generic.njk +1 -1
- package/nationalarchives/tools/_colour.scss +129 -0
- package/nationalarchives/tools/_grid.scss +2 -2
- package/nationalarchives/tools/_index.scss +5 -0
- package/nationalarchives/tools/_typography.scss +15 -0
- package/nationalarchives/utilities/_debug.scss +11 -0
- package/nationalarchives/utilities/_global.scss +65 -41
- package/nationalarchives/utilities/_index.scss +3 -0
- package/nationalarchives/utilities/_typography.scss +92 -60
- package/nationalarchives/variables/_colour.scss +96 -71
- package/nationalarchives/variables/_typography.scss +1 -1
- package/package.json +15 -14
- package/nationalarchives/components/_all.scss +0 -10
- package/nationalarchives/tools/_all.scss +0 -4
- package/nationalarchives/utilities/_all.scss +0 -2
- /package/nationalarchives/variables/{_all.scss → _index.scss} +0 -0
@@ -1,24 +1,26 @@
|
|
1
|
-
@use "../../
|
1
|
+
@use "../../tools/colour";
|
2
2
|
@use "../../tools/media";
|
3
3
|
|
4
4
|
.tna-breadcrumbs {
|
5
|
+
padding-top: 1rem;
|
6
|
+
padding-bottom: 1rem;
|
7
|
+
|
5
8
|
&__list {
|
9
|
+
margin: 0;
|
6
10
|
padding: 0;
|
7
11
|
|
8
12
|
list-style: none;
|
9
13
|
|
10
|
-
display: -ms-flexbox;
|
11
14
|
display: flex;
|
12
15
|
flex-wrap: wrap;
|
13
16
|
}
|
14
17
|
|
15
18
|
&__item {
|
16
|
-
display: -ms-flexbox;
|
17
19
|
display: flex;
|
18
20
|
|
19
21
|
+ .tna-breadcrumbs__item {
|
20
22
|
&::before {
|
21
|
-
margin: 0 0.
|
23
|
+
margin: 0 0.75rem;
|
22
24
|
|
23
25
|
display: inline-block;
|
24
26
|
|
@@ -30,11 +32,10 @@
|
|
30
32
|
&__link {
|
31
33
|
display: inline-block;
|
32
34
|
|
33
|
-
|
34
|
-
@include colour.colour-font("base-font");
|
35
|
+
@include colour.colour-font("font-base");
|
35
36
|
|
36
37
|
&:hover {
|
37
|
-
|
38
|
+
@include colour.colour-font("font-dark");
|
38
39
|
}
|
39
40
|
}
|
40
41
|
|
@@ -66,4 +67,24 @@
|
|
66
67
|
}
|
67
68
|
}
|
68
69
|
}
|
70
|
+
|
71
|
+
@mixin high-contrast {
|
72
|
+
&__link {
|
73
|
+
padding-right: 0.75rem;
|
74
|
+
padding-left: 0.75rem;
|
75
|
+
|
76
|
+
border: 1px transparent solid;
|
77
|
+
@include colour.colour-border("keyline-dark");
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.tna-template--high-contrast-theme & {
|
82
|
+
@include high-contrast;
|
83
|
+
}
|
84
|
+
|
85
|
+
@media (prefers-contrast: more) {
|
86
|
+
.tna-template--system-theme & {
|
87
|
+
@include high-contrast;
|
88
|
+
}
|
89
|
+
}
|
69
90
|
}
|
@@ -19,7 +19,7 @@
|
|
19
19
|
}
|
20
20
|
]
|
21
21
|
},
|
22
|
-
"html": "<
|
22
|
+
"html": "<div class=\"tna-breadcrumbs tna-container \"><nav class=\"tna-column tna-column--full\"><ol class=\"tna-breadcrumbs__list\"><li class=\"tna-breadcrumbs__item\"><a href=\"#/alpha\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Alpha</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/beta\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Beta</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/gamma\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Gamma</a></li></ol></nav></div>",
|
23
23
|
"hidden": false
|
24
24
|
}
|
25
25
|
]
|
@@ -1,13 +1,14 @@
|
|
1
|
-
{%- set
|
2
|
-
|
3
|
-
<nav class="tna-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
</nav>
|
1
|
+
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
2
|
+
<div class="tna-breadcrumbs tna-container {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
3
|
+
<nav class="tna-column tna-column--full">
|
4
|
+
<ol class="tna-breadcrumbs__list">
|
5
|
+
{%- for item in params.items -%}
|
6
|
+
<li class="tna-breadcrumbs__item">
|
7
|
+
<a href="{{ item.href }}" class="tna-breadcrumbs__link" data-prefix="{{ params.prefix if params.prefix else 'Back to' }}" {%- if item.title %} title="{{ item.title }}"{% endif %}>
|
8
|
+
{{ item.text }}
|
9
|
+
</a>
|
10
|
+
</li>
|
11
|
+
{%- endfor -%}
|
12
|
+
</ol>
|
13
|
+
</nav>
|
14
|
+
</div>
|
@@ -1,27 +1,35 @@
|
|
1
|
-
@use "../../
|
1
|
+
@use "../../tools/colour";
|
2
2
|
|
3
3
|
.tna-button {
|
4
4
|
padding: 0.25rem 1rem;
|
5
5
|
|
6
6
|
display: inline-block;
|
7
7
|
|
8
|
-
color: #fff;
|
9
8
|
font-weight: 700;
|
10
9
|
text-decoration: none;
|
11
10
|
|
12
|
-
|
11
|
+
@include colour.colour-background("button-primary-background");
|
13
12
|
|
14
|
-
border: 0.25rem
|
13
|
+
border: 0.25rem transparent solid;
|
14
|
+
@include colour.colour-border("button-primary-background");
|
15
15
|
|
16
16
|
transition:
|
17
17
|
color 200ms,
|
18
18
|
background-color 200ms,
|
19
19
|
border-color 200ms;
|
20
20
|
|
21
|
+
cursor: pointer;
|
22
|
+
|
23
|
+
&,
|
24
|
+
&:link,
|
25
|
+
&:visited {
|
26
|
+
@include colour.colour-font("button-primary-text");
|
27
|
+
}
|
28
|
+
|
21
29
|
&:hover {
|
22
|
-
|
30
|
+
@include colour.colour-font("button-primary-hover-text");
|
23
31
|
|
24
|
-
background-
|
32
|
+
@include colour.colour-background("button-primary-hover-background");
|
25
33
|
|
26
34
|
transition:
|
27
35
|
color 50ms,
|
@@ -30,16 +38,20 @@
|
|
30
38
|
}
|
31
39
|
|
32
40
|
&--secondary {
|
33
|
-
|
41
|
+
@include colour.colour-background("button-secondary-background");
|
34
42
|
|
35
|
-
|
43
|
+
@include colour.colour-border("button-secondary-background");
|
36
44
|
|
37
|
-
|
45
|
+
&,
|
46
|
+
&:link,
|
47
|
+
&:visited {
|
48
|
+
@include colour.colour-font("button-secondary-text");
|
49
|
+
}
|
38
50
|
|
39
51
|
&:hover {
|
40
|
-
|
52
|
+
@include colour.colour-font("button-secondary-hover-text");
|
41
53
|
|
42
|
-
|
54
|
+
@include colour.colour-background("button-secondary-hover-background");
|
43
55
|
}
|
44
56
|
}
|
45
57
|
}
|
@@ -7,7 +7,7 @@
|
|
7
7
|
"text": "Log in",
|
8
8
|
"href": "#"
|
9
9
|
},
|
10
|
-
"html": "<a href=\"#\" class=\"tna-button \"
|
10
|
+
"html": "<a href=\"#\" class=\"tna-button \">Log in</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\"
|
20
|
+
"html": "<a href=\"#\" class=\"tna-button \" title=\"Log in to the service\">Log in</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\"
|
30
|
+
"html": "<a href=\"#\" class=\"tna-button tna-button--secondary\">Log in</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\"
|
40
|
+
"html": "<a href=\"#\" class=\"tna-button button__test-class\">Log in</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\"
|
52
|
+
"html": "<a href=\"#\" class=\"tna-button \" data-testattribute=\"foobar\">Log in</a>",
|
53
53
|
"hidden": false
|
54
54
|
}
|
55
55
|
]
|
@@ -1,11 +1,10 @@
|
|
1
|
-
@use "../../
|
1
|
+
@use "../../tools/colour";
|
2
2
|
|
3
3
|
.tna-card {
|
4
|
+
margin-bottom: 1rem;
|
5
|
+
|
4
6
|
&__inner {
|
5
|
-
display: -ms-flexbox;
|
6
7
|
display: flex;
|
7
|
-
-ms-box-orient: vertical;
|
8
|
-
-ms-flex-direction: column;
|
9
8
|
flex-direction: column;
|
10
9
|
}
|
11
10
|
|
@@ -24,10 +23,26 @@
|
|
24
23
|
}
|
25
24
|
|
26
25
|
&__image-container {
|
26
|
+
margin-bottom: 1rem;
|
27
|
+
|
28
|
+
position: relative;
|
27
29
|
order: 1;
|
28
30
|
}
|
29
31
|
|
30
32
|
&__image {
|
33
|
+
height: auto;
|
34
|
+
}
|
35
|
+
|
36
|
+
&__image-label {
|
37
|
+
padding: 0 0.5rem;
|
38
|
+
|
39
|
+
position: absolute;
|
40
|
+
top: 1rem;
|
41
|
+
left: 0;
|
42
|
+
|
43
|
+
text-transform: uppercase;
|
44
|
+
|
45
|
+
background-color: #f0a;
|
31
46
|
}
|
32
47
|
|
33
48
|
&__body {
|
@@ -46,9 +61,14 @@
|
|
46
61
|
}
|
47
62
|
|
48
63
|
&--featured {
|
64
|
+
@include colour.fixed;
|
65
|
+
|
49
66
|
position: relative;
|
50
67
|
|
51
|
-
|
68
|
+
@include colour.colour-font("font-base");
|
69
|
+
|
70
|
+
// background-color: colour.$tna-yellow;
|
71
|
+
@include colour.colour-background("accent");
|
52
72
|
|
53
73
|
.tna-card__inner {
|
54
74
|
margin-left: 50%;
|
@@ -58,14 +78,21 @@
|
|
58
78
|
.tna-card__heading {
|
59
79
|
padding-bottom: 2rem;
|
60
80
|
|
61
|
-
border-bottom: 2px
|
81
|
+
border-bottom: 2px transparent solid;
|
82
|
+
@include colour.colour-border("keyline-dark");
|
83
|
+
}
|
84
|
+
|
85
|
+
.tna-card__supertitle {
|
86
|
+
color: inherit;
|
62
87
|
}
|
63
88
|
|
64
89
|
.tna-card__title-link {
|
65
|
-
|
90
|
+
@include colour.colour-font("font-dark");
|
66
91
|
}
|
67
92
|
|
68
93
|
.tna-card__image-container {
|
94
|
+
margin-bottom: 0;
|
95
|
+
|
69
96
|
position: absolute;
|
70
97
|
inset: 0 50% 0 0;
|
71
98
|
}
|
@@ -76,4 +103,21 @@
|
|
76
103
|
object-fit: cover;
|
77
104
|
}
|
78
105
|
}
|
106
|
+
|
107
|
+
@mixin high-contrast {
|
108
|
+
padding: 1rem;
|
109
|
+
|
110
|
+
border: 1px transparent solid;
|
111
|
+
@include colour.colour-border("keyline-dark");
|
112
|
+
}
|
113
|
+
|
114
|
+
.tna-template--high-contrast-theme & {
|
115
|
+
@include high-contrast;
|
116
|
+
}
|
117
|
+
|
118
|
+
@media (prefers-contrast: more) {
|
119
|
+
.tna-template--system-theme & {
|
120
|
+
@include high-contrast;
|
121
|
+
}
|
122
|
+
}
|
79
123
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():(t.TNAFrontend=t.TNAFrontend||{},t.TNAFrontend["components/card/card"]=e())}(self,(()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==o(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===o(i)?i:String(i)),r)}var i}t.r(e),t.d(e,{Card:()=>r});var r=function(){function t(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$cardTitleLink=e&&e.querySelector(".tna-card__title-link"),this.$cardAction=e&&e.querySelector(".tna-card__action"),this.tapTimeMax=o}var e,o;return e=t,(o=[{key:"init",value:function(){this.$module&&(this.$cardTitleLink||this.$cardAction)&&!this.$module.classList.contains("tna-card--no-global-click")&&(this.touchStartTime=null)}},{key:"handleCardClick",value:function(){this.$cardTitleLink?this.$cardTitleLink.click():this.$cardAction&&this.$cardAction.click()}},{key:"handleCardTouchStart",value:function(){this.touchStartTime=new Date}},{key:"handleCardTouchEnd",value:function(){(new Date).getTime()-this.touchStartTime.getTime()<this.tapTimeMax&&this.handleCardClick()}}])&&n(e.prototype,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();return e})()));
|
2
|
+
//# sourceMappingURL=card.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"components/card/card.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,wBAA0BC,IAChG,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,msBCLvD,IAAMC,EAAI,WACf,SAAAA,EAAYC,GAA2B,IAAlBC,EAAUC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,K,4FAAGG,CAAA,KAAAN,GACnCO,KAAKN,QAAUA,EACfM,KAAKC,eACHP,GAAWA,EAAQQ,cAAc,yBACnCF,KAAKG,YAAcT,GAAWA,EAAQQ,cAAc,qBACpDF,KAAKL,WAAaA,CACpB,C,QAoCC,O,EApCAF,G,EAAA,EAAAd,IAAA,OAAAa,MAED,WAEKQ,KAAKN,UACJM,KAAKC,gBAAmBD,KAAKG,eAC/BH,KAAKN,QAAQU,UAAUC,SAAS,+BAKlCL,KAAKM,eAAiB,KAMxB,GAAC,CAAA3B,IAAA,kBAAAa,MAED,WACMQ,KAAKC,eACPD,KAAKC,eAAeM,QACXP,KAAKG,aACdH,KAAKG,YAAYI,OAErB,GAAC,CAAA5B,IAAA,uBAAAa,MAED,WACEQ,KAAKM,eAAiB,IAAIE,IAC5B,GAAC,CAAA7B,IAAA,qBAAAa,MAED,YACmB,IAAIgB,MAAOC,UAAYT,KAAKM,eAAeG,UAC7CT,KAAKL,YAClBK,KAAKU,iBAET,M,oEAACjB,CAAA,CA3Cc,G","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/card/card.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/card/card\"] = 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};","export class Card {\n constructor($module, tapTimeMax = 300) {\n this.$module = $module;\n this.$cardTitleLink =\n $module && $module.querySelector(\".tna-card__title-link\");\n this.$cardAction = $module && $module.querySelector(\".tna-card__action\");\n this.tapTimeMax = tapTimeMax;\n }\n\n init() {\n if (\n !this.$module ||\n (!this.$cardTitleLink && !this.$cardAction) ||\n this.$module.classList.contains(\"tna-card--no-global-click\")\n ) {\n return;\n }\n\n this.touchStartTime = null;\n\n // this.$module.addEventListener(\"touchstart\", () =>\n // this.handleCardTouchStart(),\n // );\n // this.$module.addEventListener(\"touchend\", () => this.handleCardTouchEnd());\n }\n\n handleCardClick() {\n if (this.$cardTitleLink) {\n this.$cardTitleLink.click();\n } else if (this.$cardAction) {\n this.$cardAction.click();\n }\n }\n\n handleCardTouchStart() {\n this.touchStartTime = new Date();\n }\n\n handleCardTouchEnd() {\n const duration = new Date().getTime() - this.touchStartTime.getTime();\n if (duration < this.tapTimeMax) {\n this.handleCardClick();\n }\n }\n}\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","Card","$module","tapTimeMax","arguments","length","undefined","_classCallCheck","this","$cardTitleLink","querySelector","$cardAction","classList","contains","touchStartTime","click","Date","getTime","handleCardClick"],"sourceRoot":""}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export class Card {
|
2
|
+
constructor($module, tapTimeMax = 300) {
|
3
|
+
this.$module = $module;
|
4
|
+
this.$cardTitleLink =
|
5
|
+
$module && $module.querySelector(".tna-card__title-link");
|
6
|
+
this.$cardAction = $module && $module.querySelector(".tna-card__action");
|
7
|
+
this.tapTimeMax = tapTimeMax;
|
8
|
+
}
|
9
|
+
|
10
|
+
init() {
|
11
|
+
if (
|
12
|
+
!this.$module ||
|
13
|
+
(!this.$cardTitleLink && !this.$cardAction) ||
|
14
|
+
this.$module.classList.contains("tna-card--no-global-click")
|
15
|
+
) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
this.touchStartTime = null;
|
20
|
+
|
21
|
+
// this.$module.addEventListener("touchstart", () =>
|
22
|
+
// this.handleCardTouchStart(),
|
23
|
+
// );
|
24
|
+
// this.$module.addEventListener("touchend", () => this.handleCardTouchEnd());
|
25
|
+
}
|
26
|
+
|
27
|
+
handleCardClick() {
|
28
|
+
if (this.$cardTitleLink) {
|
29
|
+
this.$cardTitleLink.click();
|
30
|
+
} else if (this.$cardAction) {
|
31
|
+
this.$cardAction.click();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
handleCardTouchStart() {
|
36
|
+
this.touchStartTime = new Date();
|
37
|
+
}
|
38
|
+
|
39
|
+
handleCardTouchEnd() {
|
40
|
+
const duration = new Date().getTime() - this.touchStartTime.getTime();
|
41
|
+
if (duration < this.tapTimeMax) {
|
42
|
+
this.handleCardClick();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -21,7 +21,7 @@ Object.keys(argTypes).forEach((argType) => {
|
|
21
21
|
});
|
22
22
|
|
23
23
|
export default {
|
24
|
-
title: "
|
24
|
+
title: "Work in progress/Components/Card",
|
25
25
|
argTypes,
|
26
26
|
};
|
27
27
|
|
@@ -60,21 +60,23 @@ Standard.args = {
|
|
60
60
|
title: "Card title",
|
61
61
|
level: 3,
|
62
62
|
size: "m",
|
63
|
-
singleSentence:
|
63
|
+
singleSentence: false,
|
64
64
|
},
|
65
65
|
href: "#",
|
66
66
|
image: {
|
67
|
-
src: "https://
|
68
|
-
alt: "
|
67
|
+
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
68
|
+
alt: "The National Archives office",
|
69
|
+
width: 1996,
|
70
|
+
height: 1331,
|
69
71
|
},
|
70
72
|
body: "<p>Card body</p>",
|
71
|
-
actions: [
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
],
|
73
|
+
// actions: [
|
74
|
+
// {
|
75
|
+
// text: "Card action",
|
76
|
+
// href: "#",
|
77
|
+
// title: "Go and do the action",
|
78
|
+
// },
|
79
|
+
// ],
|
78
80
|
htmlElement: "article",
|
79
81
|
classes: "tna-card--demo",
|
80
82
|
};
|
@@ -86,12 +88,14 @@ Featured.args = {
|
|
86
88
|
title: "Card title",
|
87
89
|
level: 3,
|
88
90
|
size: "m",
|
89
|
-
singleSentence:
|
91
|
+
singleSentence: false,
|
90
92
|
},
|
91
93
|
href: "#",
|
92
94
|
image: {
|
93
|
-
src: "https://
|
94
|
-
alt: "
|
95
|
+
src: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg",
|
96
|
+
alt: "The National Archives office",
|
97
|
+
width: 1996,
|
98
|
+
height: 1331,
|
95
99
|
},
|
96
100
|
body: "<p>Card body</p>",
|
97
101
|
actions: [
|
@@ -10,7 +10,7 @@
|
|
10
10
|
},
|
11
11
|
"body": "<p>Card body</p>"
|
12
12
|
},
|
13
|
-
"html": "<div class=\"tna-card \"
|
13
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></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 \"
|
26
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\"><p class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</p><h3 class=\"tna-card__title tna-hgroup__title\">Card title</h3></hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div></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 \"
|
40
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><hgroup class=\"tna-card__heading tna-hgroup tna-hgroup--m\"><h3 class=\"tna-card__title tna-hgroup__title\"><span class=\"tna-card__supertitle tna-hgroup__supertitle\">Card supertitle</span>Card title</h3></hgroup><div class=\"tna-card__body\"><p>Card body</p></div></div></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 \"
|
53
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></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 \"
|
65
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></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 \"
|
78
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></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 \"
|
90
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></div>",
|
91
91
|
"hidden": false
|
92
92
|
},
|
93
93
|
{
|
@@ -99,11 +99,13 @@
|
|
99
99
|
},
|
100
100
|
"image": {
|
101
101
|
"src": "https://loremflickr.com/640/360",
|
102
|
-
"alt": "A placeholder image"
|
102
|
+
"alt": "A placeholder image",
|
103
|
+
"width": 640,
|
104
|
+
"height": 360
|
103
105
|
},
|
104
106
|
"body": "<p>Card body</p>"
|
105
107
|
},
|
106
|
-
"html": "<div class=\"tna-card \"
|
108
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__image-container\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\" class=\"tna-card__image\" /></div><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
107
109
|
"hidden": false
|
108
110
|
},
|
109
111
|
{
|
@@ -122,7 +124,7 @@
|
|
122
124
|
}
|
123
125
|
]
|
124
126
|
},
|
125
|
-
"html": "<div class=\"tna-card \"
|
127
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><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></div>",
|
126
128
|
"hidden": false
|
127
129
|
},
|
128
130
|
{
|
@@ -135,7 +137,7 @@
|
|
135
137
|
"body": "<p>Card body</p>",
|
136
138
|
"classes": "card__test-class"
|
137
139
|
},
|
138
|
-
"html": "<div class=\"tna-card card__test-class\"
|
140
|
+
"html": "<div class=\"tna-card card__test-class\" data-module=\"tna-card\"><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></div>",
|
139
141
|
"hidden": false
|
140
142
|
},
|
141
143
|
{
|
@@ -150,7 +152,7 @@
|
|
150
152
|
"data-testattribute": "foobar"
|
151
153
|
}
|
152
154
|
},
|
153
|
-
"html": "<div class=\"tna-card \" data-testattribute=\"foobar\"
|
155
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\" data-testattribute=\"foobar\"><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></div>",
|
154
156
|
"hidden": false
|
155
157
|
}
|
156
158
|
]
|
@@ -60,6 +60,24 @@
|
|
60
60
|
"type": "string",
|
61
61
|
"required": true,
|
62
62
|
"description": ""
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"name": "label",
|
66
|
+
"type": "string",
|
67
|
+
"required": false,
|
68
|
+
"description": ""
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"name": "width",
|
72
|
+
"type": "number",
|
73
|
+
"required": true,
|
74
|
+
"description": ""
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"name": "height",
|
78
|
+
"type": "number",
|
79
|
+
"required": true,
|
80
|
+
"description": ""
|
63
81
|
}
|
64
82
|
]
|
65
83
|
},
|