mp-design-system 0.6.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/build/js/app.js +12 -6
- package/dist/build/js/app.js.map +1 -1
- package/dist/build/scss/library.css +1 -1
- package/dist/build/scss/library.css.map +1 -1
- package/dist/build/scss/main.css +1 -1
- package/dist/build/scss/main.css.map +1 -1
- package/package.json +1 -1
- package/src/_includes/components/accordion/accordion.config.js +27 -0
- package/src/_includes/components/accordion/accordion.md +15 -0
- package/src/_includes/components/accordion/accordion.njk +10 -0
- package/src/_includes/components/accordion/accordion.scss +49 -0
- package/src/_includes/components/accordion/macro.njk +5 -0
- package/src/_includes/components/button/button.njk +1 -1
- package/src/_includes/components/campaign/campaign.config.js +3 -3
- package/src/_includes/components/card/card.scss +0 -14
- package/src/_includes/components/comparison-table/comparison-table.scss +5 -0
- package/src/_includes/components/hero/hero.config.js +27 -3
- package/src/_includes/components/hero/hero.njk +29 -1
- package/src/_includes/components/hero/hero.scss +61 -1
- package/src/_includes/components/industry-card/industry-card.njk +2 -2
- package/src/_includes/components/industry-card/industry-card.scss +4 -4
- package/src/_includes/components/meta-box/meta-box.scss +5 -1
- package/src/_includes/components/table/table.config.js +12 -0
- package/src/_includes/components/table/table.njk +8 -2
- package/src/_includes/includes/related-events.njk +1 -1
- package/src/_includes/includes/resources.njk +1 -1
- package/src/_includes/layout.njk +28 -4
- package/src/assets/js/app.js +8 -2
- package/src/assets/js/imports/accordion.js +19 -0
- package/src/assets/js/imports/hero-video.js +34 -0
- package/src/assets/js/imports/scrollbar-width.js +15 -0
- package/src/assets/js/imports/utilities.js +10 -0
- package/src/assets/scss/components/gallery.scss +16 -68
- package/src/assets/scss/components/index.scss +2 -0
- package/src/assets/scss/components/lightbox.scss +62 -0
- package/src/assets/scss/library.scss +6 -2
- package/src/assets/scss/tools/breakout.scss +2 -0
- package/src/assets/scss/utilities/display.scss +6 -4
- package/src/assets/scss/utilities/hr.scss +4 -0
- package/src/assets/scss/utilities/index.scss +4 -0
- package/src/brand/downloads.njk +2 -2
- package/src/brand/visual/images.md +17 -17
- package/src/components/utilities.md +47 -4
- package/src/prototype/index.njk +1 -1
- package/src/prototype/product.njk +24 -1
- package/src/prototype/range.njk +1 -1
- package/src/static/pdf/PN12558_Physical_branding_v23.pdf +0 -0
- package/src/static/img/grid-captivate-2.jpg +0 -0
- package/src/static/img/grid-captivate-3.jpg +0 -0
- package/src/static/img/grid-captivate-4.jpg +0 -0
- package/src/static/img/grid-convince-1.jpg +0 -0
- package/src/static/img/grid-convince-2.jpg +0 -0
- package/src/static/img/grid-convince-3.jpg +0 -0
- package/src/static/img/grid-convince-4.jpg +0 -0
- package/src/static/img/grid-convince-6.jpg +0 -0
- package/src/static/img/grid-inform-applications-1.jpg +0 -0
- package/src/static/img/grid-inform-applications-2.jpg +0 -0
- package/src/static/img/grid-inform-applications-3.jpg +0 -0
- package/src/static/img/grid-inform-tech-1.jpg +0 -0
- package/src/static/img/grid-inform-tech-2.jpg +0 -0
- package/src/static/img/grid-inform-tech-4.jpg +0 -0
- package/src/static/img/grid-inspire-1.jpg +0 -0
- package/src/static/img/grid-inspire-2.jpg +0 -0
- package/src/static/img/grid-inspire-3.jpg +0 -0
- package/src/static/img/grid-inspire-4.jpg +0 -0
- package/src/static/img/grid-inspire-5.jpg +0 -0
- package/src/static/pdf/FINAL Tone of voice guidelines April 2021.pdf +0 -0
- package/src/static/pdf/Mastersizer 3000.pdf +58 -53069
- package/src/static/pdf/PN12316_Digital_brand_quickstart_v06.pdf +45 -19388
- package/src/static/ppt/MP Elevator pitch.pptx +0 -0
package/package.json
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module.exports = {
|
2
|
+
title: 'Accordion',
|
3
|
+
component: {
|
4
|
+
name: 'accordion'
|
5
|
+
},
|
6
|
+
docs: true,
|
7
|
+
context: {
|
8
|
+
items: [
|
9
|
+
{
|
10
|
+
title: 'Do I need to prepare the workspace prior to installation?',
|
11
|
+
content: 'All instruments need a power source, and some have additional requirements such as a water supply or waste extraction. Where this the case, we will advise you prior to shipping your instrument.'
|
12
|
+
},
|
13
|
+
{
|
14
|
+
title: 'What specialist skills or knowledge are required?',
|
15
|
+
content: 'You don\'t need any specialist skills or knowledge to perform a Smart Install. Simply follow the instructions provided.'
|
16
|
+
},
|
17
|
+
{
|
18
|
+
title: 'Do I need specialist tools or equipment to Smart Install a new instrument?',
|
19
|
+
content: '<ul><li>For installation of a Mastersizer or Zetasizer system, you will need a computer with internet access in order to view the installation guides. For installation of an Epsilon 1 XRF instrument, you will also need a smartphone or tablet to connect with our support personnel via a secure, augmented reality (AR) platform.</li><li>Everything else you need to install your new instrument will be provided.</li></ul>'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
title: 'What languages are available for the Smart Install guides?',
|
23
|
+
content: '<ul><li>Mastersizer: English, Chinese, Korean, French, German and Japanese</li><li>Zetasizer: English, Chinese, Korean, French, German and Japanese</li><li>Epsilon 1: English, French, German and Japanese, Spanish and Portuguese</li></ul>'
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
## Blank HTML template
|
2
|
+
```
|
3
|
+
<dl class="c-accordion">
|
4
|
+
<div class="c-accordion__item">
|
5
|
+
<dt class="c-accordion__title">Title one</dt>
|
6
|
+
<dd class="c-accordion__content o-prose u-flow--prose">Content one</dd>
|
7
|
+
</div>
|
8
|
+
<div class="c-accordion__item">
|
9
|
+
<dt class="c-accordion__title">Title two</dt>
|
10
|
+
<dd class="c-accordion__content o-prose u-flow--prose">Content two</dd>
|
11
|
+
</div>
|
12
|
+
</dl>
|
13
|
+
```
|
14
|
+
- To make an item display in its opened state when the page loads, add the class `c-accordion--item__open`
|
15
|
+
- The classnames `o-prose` and `u-flow--prose` on the content are optional
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{% from "components/icon/macro.njk" import icon %}
|
2
|
+
|
3
|
+
<dl class="c-accordion">
|
4
|
+
{% for item in params.items %}
|
5
|
+
<div class="c-accordion__item {{ 'c-accordion__item--open' if item.state }}">
|
6
|
+
<dt class="c-accordion__title">{{ item.title }}</dt>
|
7
|
+
<dd class="c-accordion__content o-prose u-flow--prose">{{ item.content | safe }}</dd>
|
8
|
+
</div>
|
9
|
+
{% endfor %}
|
10
|
+
</dl>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
.c-accordion {
|
2
|
+
&__item {
|
3
|
+
@include padding('xs',0);
|
4
|
+
|
5
|
+
& + & {
|
6
|
+
border-top: 1px solid color('petrol', 'step-2');
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
&__title {
|
11
|
+
@include step(1);
|
12
|
+
@include padding('xs',0);
|
13
|
+
cursor: pointer;
|
14
|
+
font-weight: weight('bold');
|
15
|
+
position: relative;
|
16
|
+
|
17
|
+
&:before {
|
18
|
+
background-image: url('data:image/svg+xml;utf8,<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 1V17M1 9H17" stroke="%23252525" stroke-width="2" stroke-linecap="round"/></svg>');
|
19
|
+
background-position: center center;
|
20
|
+
background-repeat: no-repeat;
|
21
|
+
content: "";
|
22
|
+
display: block;
|
23
|
+
height: 1em;
|
24
|
+
left: 0;
|
25
|
+
position: absolute;
|
26
|
+
width: 1em;
|
27
|
+
}
|
28
|
+
|
29
|
+
.c-accordion__item--open &:before {
|
30
|
+
background-image: url('data:image/svg+xml;utf8,<svg width="10" height="2" viewBox="0 0 10 2" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1H9" stroke="%23252525" stroke-width="2" stroke-linecap="round"/></svg>');
|
31
|
+
transform: scaleX(1.75);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
&__content {
|
36
|
+
margin-left: 0;
|
37
|
+
@include padding-bottom('xs');
|
38
|
+
display: none;
|
39
|
+
|
40
|
+
.c-accordion__item--open & {
|
41
|
+
display: block;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
&__title,
|
46
|
+
&__content {
|
47
|
+
@include padding-left('l-xl');
|
48
|
+
}
|
49
|
+
}
|
@@ -22,7 +22,7 @@
|
|
22
22
|
{%- elseif params.type == 'span' -%}
|
23
23
|
<span class="{{ classNames }}" {{ attrs }}>
|
24
24
|
{%- else -%}
|
25
|
-
<button type="{{ params.type or 'button' }}" class="{{ classNames}}"{{ attrs }}>
|
25
|
+
<button type="{{ params.type or 'button' }}" class="{{ classNames}}" {{ attrs }}>
|
26
26
|
{%- endif -%}
|
27
27
|
{%- if params.icon -%}
|
28
28
|
{{ twi({ icon: params.icon, align: params.align, label: params.label }) }}
|
@@ -24,19 +24,19 @@ module.exports = {
|
|
24
24
|
{
|
25
25
|
title: 'Petrol',
|
26
26
|
context: {
|
27
|
-
classes: 'c-
|
27
|
+
classes: 'c-campaign--petrol'
|
28
28
|
}
|
29
29
|
},
|
30
30
|
{
|
31
31
|
title: 'Blue',
|
32
32
|
context: {
|
33
|
-
classes: 'c-
|
33
|
+
classes: 'c-campaign--blue'
|
34
34
|
}
|
35
35
|
},
|
36
36
|
{
|
37
37
|
title: 'Orange',
|
38
38
|
context: {
|
39
|
-
classes: 'c-
|
39
|
+
classes: 'c-campaign--orange'
|
40
40
|
}
|
41
41
|
}
|
42
42
|
],
|
@@ -170,20 +170,6 @@
|
|
170
170
|
}
|
171
171
|
}
|
172
172
|
|
173
|
-
// &--fixed-aspect figure {
|
174
|
-
// height: 0;
|
175
|
-
// padding-bottom: 62.5%;
|
176
|
-
// aspect-ratio: 16/10;
|
177
|
-
// position: relative;
|
178
|
-
// }
|
179
|
-
// &--image-margin figure {
|
180
|
-
// @include margin("s-m", "s-m", 0, "s-m");
|
181
|
-
// }
|
182
|
-
|
183
|
-
&--layout-single &__figure {
|
184
|
-
@extend .u-16\/9;
|
185
|
-
}
|
186
|
-
|
187
173
|
&__primary {
|
188
174
|
@include flow("s");
|
189
175
|
}
|
@@ -48,14 +48,14 @@ module.exports = {
|
|
48
48
|
},
|
49
49
|
cta: {
|
50
50
|
label: 'Download brochure',
|
51
|
-
link: '/
|
51
|
+
link: 'https://www.malvernpanalytical.com/en/assets/Mastersizer%203000%20Brochure%20%28EN%29_tcm50-58994.pdf',
|
52
52
|
attrs: 'download',
|
53
53
|
icon: 'file'
|
54
54
|
}
|
55
55
|
}
|
56
56
|
},
|
57
57
|
{
|
58
|
-
title: '
|
58
|
+
title: 'Homepage',
|
59
59
|
context: {
|
60
60
|
title: "We’re big on small.",
|
61
61
|
subtitle: null,
|
@@ -76,7 +76,7 @@ module.exports = {
|
|
76
76
|
}
|
77
77
|
},
|
78
78
|
{
|
79
|
-
title: '
|
79
|
+
title: 'Homepage (light)',
|
80
80
|
context: {
|
81
81
|
title: "We’re big on small.",
|
82
82
|
subtitle: null,
|
@@ -96,6 +96,30 @@ module.exports = {
|
|
96
96
|
homepage: 'light'
|
97
97
|
}
|
98
98
|
},
|
99
|
+
// {
|
100
|
+
// title: 'Homepage with video',
|
101
|
+
// context: {
|
102
|
+
// title: 'We\'re big on small.',
|
103
|
+
// subtitle: null,
|
104
|
+
// content: '<p>We make scientific instruments and services that make the invisible visible, and the impossible possible.</p>',
|
105
|
+
// videoplaceholder: {
|
106
|
+
// src: 'https://p3.aprimocdn.net/malvernpanalytical/bf169dc6-9edb-4609-9ba8-add301206d1e/bridge-bg_Original%20file.webp?quality=60'
|
107
|
+
// },
|
108
|
+
// shortvideo: [
|
109
|
+
// { src: '' },
|
110
|
+
// { type: 'video/mp4' },
|
111
|
+
// ],
|
112
|
+
// longvideo: [
|
113
|
+
// { src: '' },
|
114
|
+
// { type: 'video/mp4' },
|
115
|
+
// ],
|
116
|
+
// cta: {
|
117
|
+
// label: 'About Malvern Panalytical',
|
118
|
+
// link: ''
|
119
|
+
// },
|
120
|
+
// homepage: 'dark'
|
121
|
+
// },
|
122
|
+
// }
|
99
123
|
],
|
100
124
|
props: [
|
101
125
|
{
|
@@ -1,5 +1,7 @@
|
|
1
1
|
{% from "components/twi/macro.njk" import twi %}
|
2
2
|
{% from "components/breadcrumb/macro.njk" import breadcrumb %}
|
3
|
+
{% from "components/button/macro.njk" import button %}
|
4
|
+
{% from "components/icon/macro.njk" import icon %}
|
3
5
|
|
4
6
|
{%- set classes = 'mp c-hero' -%}
|
5
7
|
{% if params.classes %}{%- set classes = classes + ' ' + params.classes -%}{% endif %}
|
@@ -11,6 +13,10 @@
|
|
11
13
|
{%- set classes = classes + ' c-hero--homepage-light' -%}
|
12
14
|
{% endif %}
|
13
15
|
|
16
|
+
{% if params.shortvideo %}
|
17
|
+
{%- set classes = classes + ' c-hero--homepage-video' -%}
|
18
|
+
{% endif %}
|
19
|
+
|
14
20
|
<figure class="{{ classes }}">
|
15
21
|
<div class="u-wrap">
|
16
22
|
<div class="c-hero__content">
|
@@ -38,7 +44,6 @@
|
|
38
44
|
</div>
|
39
45
|
</div>
|
40
46
|
|
41
|
-
|
42
47
|
{% if params.image %}
|
43
48
|
<div class="c-hero__image-bg" style="background-image:url({{ params.image.src }});"></div>
|
44
49
|
{% elif params.images %}
|
@@ -47,6 +52,14 @@
|
|
47
52
|
{% endfor %}
|
48
53
|
{% endif %}
|
49
54
|
|
55
|
+
{% if params.shortvideo %}
|
56
|
+
<div class="c-hero__video-bg" style="background-image:url({{ params.videoplaceholder.src }});">
|
57
|
+
<video id="videoBackground" autoplay loop>
|
58
|
+
<source src="https://p3.aprimocdn.net/malvernpanalytical/304f04aa-ae04-4bed-9946-ae3101152327/PN12593_Brand_Movie_Malvern_Panalytical_MIX_0dBfs_website_header_Original%20file.mp4" type="video/mp4">
|
59
|
+
</video>
|
60
|
+
</div>
|
61
|
+
{% endif %}
|
62
|
+
|
50
63
|
{% if params.homepage %}
|
51
64
|
<canvas class="c-hero__canvas"></canvas>
|
52
65
|
{% endif %}
|
@@ -56,4 +69,19 @@
|
|
56
69
|
<div class="c-hero__image-fg" style="background-image:url({{ image.src }});"></div>
|
57
70
|
{% endfor %}
|
58
71
|
{% endif %}
|
72
|
+
|
73
|
+
{% if params.longvideo %}
|
74
|
+
{{ button({ link: '', label: 'Play video', colour: 'outline-white', classes: 'c-hero__button', attrs: 'id=playVideo' }) }}
|
75
|
+
{% endif %}
|
59
76
|
</figure>
|
77
|
+
|
78
|
+
<div id="lightboxVideo" class="c-lightbox u-hidden">
|
79
|
+
<div class="c-lightbox__close">
|
80
|
+
{{ icon({ id: 'cross' }) }}
|
81
|
+
</div>
|
82
|
+
<div class="c-lightbox__slide active">
|
83
|
+
<video class="c-lightbox__video" controls controlslist="nodownload">
|
84
|
+
<source src="https://p3.aprimocdn.net/malvernpanalytical/304f04aa-ae04-4bed-9946-ae3101152327/PN12593_Brand_Movie_Malvern_Panalytical_MIX_0dBfs_website_header_Original%20file.mp4" type="video/mp4">
|
85
|
+
</video>
|
86
|
+
</div>
|
87
|
+
</div>
|
@@ -141,7 +141,6 @@
|
|
141
141
|
z-index: -1;
|
142
142
|
transition: opacity 3s ease;
|
143
143
|
background-position: 60% 40%;
|
144
|
-
-webkit-mask-image: radial-gradient(circle farthest-side at top right, black 80%, transparent 98%);
|
145
144
|
|
146
145
|
&:after {
|
147
146
|
display: none;
|
@@ -160,6 +159,67 @@
|
|
160
159
|
}
|
161
160
|
}
|
162
161
|
|
162
|
+
&--homepage-video {
|
163
|
+
position: relative;
|
164
|
+
|
165
|
+
&::after {
|
166
|
+
position: absolute;
|
167
|
+
content: '';
|
168
|
+
top: 0;
|
169
|
+
left: 0;
|
170
|
+
background: rgba(black, 0.33);
|
171
|
+
width: 100%;
|
172
|
+
height: 100%;
|
173
|
+
|
174
|
+
@media (min-width: 38em) {
|
175
|
+
background: radial-gradient(circle farthest-side at top right, rgba(46, 50, 51, 0) 0%, rgba(46, 50, 51, 0) 15.16%, rgba(46, 50, 51, 0.2) 27.66%, rgba(41, 54, 56, 0.55) 39.61%, rgba(35, 66, 71, 0.8) 49.78%, #005461 59.87%, #003039 100%);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
.c-hero {
|
180
|
+
&__video-bg {
|
181
|
+
width: 100%;
|
182
|
+
height: auto;
|
183
|
+
margin-bottom: -6px;
|
184
|
+
background-size: cover;
|
185
|
+
|
186
|
+
@media (min-width: 38em) {
|
187
|
+
position: absolute;
|
188
|
+
top: 50%;
|
189
|
+
right: 0;
|
190
|
+
left: 40%;
|
191
|
+
max-width: 60%;
|
192
|
+
height: 100%;
|
193
|
+
transform: translateY(-50%);
|
194
|
+
}
|
195
|
+
|
196
|
+
video {
|
197
|
+
width: 100%;
|
198
|
+
height: 100%;
|
199
|
+
object-fit: cover;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
&__button {
|
204
|
+
position: absolute;
|
205
|
+
z-index: 2;
|
206
|
+
right: 0;
|
207
|
+
bottom: calc(56.25% / 2 - 25px);
|
208
|
+
left: 0;
|
209
|
+
background: rgba(black, 0.2);
|
210
|
+
margin: 0 auto;
|
211
|
+
|
212
|
+
@media (min-width: 38em) {
|
213
|
+
position: absolute;
|
214
|
+
top: 45%;
|
215
|
+
right: 20%;
|
216
|
+
bottom: unset;
|
217
|
+
left: unset;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
163
223
|
&--homepage-light {
|
164
224
|
@extend .c-hero--homepage;
|
165
225
|
background: linear-gradient(79.62deg, color('petrol', 'step-3') 0%, color('blue', 'step-2') 100%), color('petrol', 'step-3');
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<article class="mp c-industry-card">
|
2
2
|
<a class="c-industry-card__link u-flow--xs" href="{{ params.link }}">
|
3
|
-
<figure class="c-industry-card__image
|
4
|
-
<img class="u-
|
3
|
+
<figure class="c-industry-card__image">
|
4
|
+
<img class="u-2/1" src="{{ params.image.src }}" alt="{{ params.image.alt or params.title }}" />
|
5
5
|
</figure>
|
6
6
|
<h3 class="c-h c-h--reset">{{ params.title }}</h3>
|
7
7
|
</a>
|
@@ -17,6 +17,18 @@ module.exports = {
|
|
17
17
|
classes: 'c-table--fixed'
|
18
18
|
}
|
19
19
|
},
|
20
|
+
{
|
21
|
+
title: 'Vertical headers',
|
22
|
+
context: {
|
23
|
+
theme: 'vertical'
|
24
|
+
}
|
25
|
+
},
|
26
|
+
{
|
27
|
+
title: 'No headers',
|
28
|
+
context: {
|
29
|
+
theme: 'none'
|
30
|
+
}
|
31
|
+
},
|
20
32
|
{
|
21
33
|
title: 'Center',
|
22
34
|
context: {
|
@@ -1,16 +1,22 @@
|
|
1
1
|
<table class="mp c-table {{ params.classes }}" {{ params.attrs }}>
|
2
|
+
{% if params.theme != 'none'%}
|
2
3
|
<thead>
|
3
4
|
<tr>
|
4
5
|
{% for header in params.headers %}
|
5
|
-
|
6
|
+
{% if (params.theme != 'vertical') or ((params.theme == 'vertical') and (loop.index0 == 0)) %}
|
7
|
+
<th>{{ header | safe }}</th>
|
8
|
+
{% else %}
|
9
|
+
<td>{{ header | safe }}</td>
|
10
|
+
{% endif %}
|
6
11
|
{% endfor %}
|
7
12
|
</tr>
|
8
13
|
</thead>
|
14
|
+
{% endif %}
|
9
15
|
<tbody>
|
10
16
|
{% for row in params.rows %}
|
11
17
|
<tr>
|
12
18
|
{% for cell in row %}
|
13
|
-
{% if loop.index0 == 0 %}
|
19
|
+
{% if (params.theme == 'vertical') and (loop.index0 == 0) %}
|
14
20
|
<th>{{ cell | safe }}</th>
|
15
21
|
{% else %}
|
16
22
|
<td>{{ cell | safe }}</td>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<aside class="c-slat c-slat--grey c-slat--padded">
|
4
4
|
<div class="u-wrap u-flow">
|
5
5
|
<h3 class="c-h c-h--upper">Related events</h3>
|
6
|
-
<div class="o-grid o-grid--of-three">
|
6
|
+
<div class="o-grid o-grid--of-three o-grid--swipeable">
|
7
7
|
{{ card({
|
8
8
|
theme: {
|
9
9
|
layout: 'single',
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<aside class="mp c-slat c-slat--grey c-slat--padded">
|
4
4
|
<div class="u-wrap u-flow--xl">
|
5
5
|
<h2 class="c-h c-h--step-3">Related resources</h2>
|
6
|
-
<div class="o-grid o-grid--of-three">
|
6
|
+
<div class="o-grid o-grid--of-three o-grid--swipeable">
|
7
7
|
{{ card({
|
8
8
|
theme: {
|
9
9
|
layout: 'single',
|
package/src/_includes/layout.njk
CHANGED
@@ -14,10 +14,31 @@
|
|
14
14
|
<meta property="og:image:alt" content="{{ config.name }}" />
|
15
15
|
<meta name="twitter:image" content="{{ config.openGraphImage }}" />
|
16
16
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
17
|
-
<script>
|
18
|
-
document.documentElement
|
19
|
-
|
20
|
-
|
17
|
+
<script>
|
18
|
+
if(document.documentElement){
|
19
|
+
document.documentElement.classList.add('has-js');
|
20
|
+
document.documentElement.classList.remove('no-js');
|
21
|
+
}
|
22
|
+
// Calculate the height of the sidebar so it doesn't cause double scrollbars
|
23
|
+
function debounce(func, wait, immediate) {
|
24
|
+
var timeout;
|
25
|
+
return function() {
|
26
|
+
var context = this, args = arguments;
|
27
|
+
var later = function() {
|
28
|
+
timeout = null;
|
29
|
+
if (!immediate) func.apply(context, args);
|
30
|
+
};
|
31
|
+
var callNow = immediate && !timeout;
|
32
|
+
clearTimeout(timeout);
|
33
|
+
timeout = setTimeout(later, wait);
|
34
|
+
if (callNow) func.apply(context, args);
|
35
|
+
};
|
36
|
+
};
|
37
|
+
var resizeSidebar = debounce(function() {
|
38
|
+
var headerHeight = document.querySelector('.c-library__header').offsetHeight + 'px';
|
39
|
+
document.documentElement.style.setProperty('--headerHeight', headerHeight)
|
40
|
+
}, 250);
|
41
|
+
</script>
|
21
42
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-32x32.png">
|
22
43
|
<link rel="stylesheet" href="/build/scss/main.css" />
|
23
44
|
<script>window.MSInputMethodContext && document.documentMode && document.write('<script src="https://cdn.jsdelivr.net/gh/nuxodin/ie11CustomProperties@4.1.0/ie11CustomProperties.min.js"><\/script>');</script>
|
@@ -30,12 +51,15 @@
|
|
30
51
|
<script src="/build/js/app.js"></script>
|
31
52
|
<script>
|
32
53
|
(function() {
|
54
|
+
// Prevent empty links from jumping to the top of page when clicked
|
33
55
|
var links = document.querySelectorAll('a[href=""],a[href="#"]');
|
34
56
|
for(var i = 0; links.length > i; i++) {
|
35
57
|
links[i].addEventListener('click', function(event) {
|
36
58
|
event.preventDefault();
|
37
59
|
})
|
38
60
|
}
|
61
|
+
window.addEventListener('resize', resizeSidebar);
|
62
|
+
resizeSidebar();
|
39
63
|
})();
|
40
64
|
</script>
|
41
65
|
</body>
|
package/src/assets/js/app.js
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
import Accordion from './imports/accordion';
|
1
2
|
import Carousel from './imports/carousel';
|
2
3
|
import ClearForm from './imports/clear-form';
|
3
4
|
import Comparison from './imports/comparison';
|
4
5
|
import Gallery from './imports/gallery';
|
5
6
|
import HeroPattern from './imports/hero-pattern';
|
7
|
+
import HeroVideo from './imports/hero-video';
|
6
8
|
import ResponsiveTable from './imports/responsive-table';
|
9
|
+
import ScrollbarWidth from './imports/scrollbar-width';
|
7
10
|
import ScrollSpy from './imports/scroll-spy';
|
8
11
|
import Tabs from './imports/tabs';
|
9
12
|
|
@@ -15,12 +18,15 @@ import Tabs from './imports/tabs';
|
|
15
18
|
HTMLCollection.prototype.forEach = Array.prototype.forEach;
|
16
19
|
}
|
17
20
|
|
21
|
+
Accordion();
|
18
22
|
Carousel();
|
19
23
|
ClearForm();
|
20
24
|
Comparison();
|
21
25
|
Gallery();
|
22
26
|
HeroPattern();
|
23
|
-
|
24
|
-
ScrollSpy();
|
27
|
+
HeroVideo();
|
25
28
|
ResponsiveTable();
|
29
|
+
ScrollbarWidth();
|
30
|
+
ScrollSpy();
|
31
|
+
Tabs();
|
26
32
|
})();
|
@@ -0,0 +1,19 @@
|
|
1
|
+
function Accordion() {
|
2
|
+
const accordions = Array.from(document.querySelectorAll('.c-accordion__title'));
|
3
|
+
accordions.forEach(setupAccordions);
|
4
|
+
}
|
5
|
+
|
6
|
+
function setupAccordions(title) {
|
7
|
+
title.addEventListener('click', titleClick())
|
8
|
+
}
|
9
|
+
|
10
|
+
function titleClick() {
|
11
|
+
return (event) => {
|
12
|
+
console.log(event)
|
13
|
+
var item = event.currentTarget.parentElement;
|
14
|
+
console.log(item)
|
15
|
+
item.classList.toggle('c-accordion__item--open');
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
export default Accordion;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
function HeroVideo() {
|
2
|
+
document.addEventListener("DOMContentLoaded", () => {
|
3
|
+
const videoBackground = document.getElementById('videoBackground');
|
4
|
+
if(typeof(videoBackground) != 'undefined' && videoBackground != null) {
|
5
|
+
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
6
|
+
if(!reducedMotion || reducedMotion.matches) {
|
7
|
+
videoBackground.classList.add('u-hidden');
|
8
|
+
}
|
9
|
+
|
10
|
+
const lightboxTrigger = document.getElementById('playVideo');
|
11
|
+
const lightboxVideo = document.getElementById('lightboxVideo');
|
12
|
+
|
13
|
+
lightboxTrigger.addEventListener('click', e => {
|
14
|
+
videoBackground.removeAttribute('autoplay');
|
15
|
+
lightboxVideo.classList.remove('u-hidden');
|
16
|
+
});
|
17
|
+
|
18
|
+
lightboxVideo.addEventListener('click', (e) => {
|
19
|
+
if (!e.target.classList.contains('c-lightbox__video')) {
|
20
|
+
videoBackground.setAttribute('autoplay','');
|
21
|
+
lightboxVideo.classList.add('u-hidden');
|
22
|
+
}
|
23
|
+
});
|
24
|
+
window.addEventListener('keydown', function(e) {
|
25
|
+
if (e.key == "Escape") {
|
26
|
+
videoBackground.setAttribute('autoplay','');
|
27
|
+
lightboxVideo.classList.add('u-hidden');
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
export default HeroVideo;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { debounce } from './utilities';
|
2
|
+
|
3
|
+
function ScrollbarWidth() {
|
4
|
+
setScrollbarWidth();
|
5
|
+
window.addEventListener('resize', debounce(setScrollbarWidth, 250));
|
6
|
+
}
|
7
|
+
|
8
|
+
function setScrollbarWidth() {
|
9
|
+
document.documentElement.style.setProperty(
|
10
|
+
'--scrollbarWidth',
|
11
|
+
window.innerWidth - document.body.clientWidth + 'px'
|
12
|
+
);
|
13
|
+
}
|
14
|
+
|
15
|
+
export default ScrollbarWidth;
|
@@ -15,6 +15,16 @@ export function userPrefersReducedMotion() {
|
|
15
15
|
return prefersReducedMotion;
|
16
16
|
}
|
17
17
|
|
18
|
+
export const debounce = (func, limit) => {
|
19
|
+
let wait = false;
|
20
|
+
return () => {
|
21
|
+
if (wait) return;
|
22
|
+
func();
|
23
|
+
wait = true;
|
24
|
+
setTimeout(() => wait = false, limit);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
18
28
|
export const lerp = (x, y, a) => x * (1 - a) + y * a;
|
19
29
|
export const clamp = (a, min = 0, max = 1) => Math.min(max, Math.max(min, a));
|
20
30
|
export const invlerp = (x, y, a) => clamp((a - x) / (y - x));
|