mp-design-system 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/build/js/app.js +8 -6
- package/dist/build/js/app.js.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/button/button.njk +1 -1
- package/src/_includes/components/hero/hero.config.js +26 -2
- package/src/_includes/components/hero/hero.njk +23 -1
- package/src/_includes/components/hero/hero.scss +34 -0
- package/src/_includes/components/table/table.config.js +12 -0
- package/src/_includes/components/table/table.njk +8 -2
- package/src/assets/js/app.js +5 -3
- package/src/assets/js/imports/hero-video.js +34 -0
- package/src/assets/scss/components/gallery.scss +0 -50
- package/src/assets/scss/components/index.scss +1 -0
- package/src/assets/scss/components/lightbox.scss +62 -0
package/package.json
CHANGED
@@ -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 }) }}
|
@@ -55,7 +55,7 @@ module.exports = {
|
|
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
|
+
// images: [
|
106
|
+
// { src: '/static/img/homepage_1_back.webp' },
|
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 %}
|
@@ -38,7 +40,6 @@
|
|
38
40
|
</div>
|
39
41
|
</div>
|
40
42
|
|
41
|
-
|
42
43
|
{% if params.image %}
|
43
44
|
<div class="c-hero__image-bg" style="background-image:url({{ params.image.src }});"></div>
|
44
45
|
{% elif params.images %}
|
@@ -47,6 +48,12 @@
|
|
47
48
|
{% endfor %}
|
48
49
|
{% endif %}
|
49
50
|
|
51
|
+
{% if params.shortvideo %}
|
52
|
+
<video id="videoBackground" class="c-hero__video-bg" autoplay loop>
|
53
|
+
<source src="" type="video/mp4">
|
54
|
+
</video>
|
55
|
+
{% endif %}
|
56
|
+
|
50
57
|
{% if params.homepage %}
|
51
58
|
<canvas class="c-hero__canvas"></canvas>
|
52
59
|
{% endif %}
|
@@ -56,4 +63,19 @@
|
|
56
63
|
<div class="c-hero__image-fg" style="background-image:url({{ image.src }});"></div>
|
57
64
|
{% endfor %}
|
58
65
|
{% endif %}
|
66
|
+
|
67
|
+
{% if params.longvideo %}
|
68
|
+
{{ button({ link: '', label: 'Play video', colour: 'outline-white', classes: 'c-hero__button', attrs: 'id=playVideo' }) }}
|
69
|
+
{% endif %}
|
59
70
|
</figure>
|
71
|
+
|
72
|
+
<div id="lightboxVideo" class="c-lightbox u-hidden">
|
73
|
+
<div class="c-lightbox__close">
|
74
|
+
{{ icon({ id: 'cross' }) }}
|
75
|
+
</div>
|
76
|
+
<div class="c-lightbox__slide active">
|
77
|
+
<video class="c-lightbox__video" controls controlslist="nodownload">
|
78
|
+
<source src="" type="video/mp4">
|
79
|
+
</video>
|
80
|
+
</div>
|
81
|
+
</div>
|
@@ -157,6 +157,40 @@
|
|
157
157
|
@extend .c-hero__image-bg;
|
158
158
|
z-index: 1;
|
159
159
|
}
|
160
|
+
|
161
|
+
&__video-bg {
|
162
|
+
width: 100%;
|
163
|
+
height: auto;
|
164
|
+
margin-bottom: -6px;
|
165
|
+
|
166
|
+
@media (min-width: 38em) {
|
167
|
+
position: absolute;
|
168
|
+
top: 0;
|
169
|
+
right: 0;
|
170
|
+
left: 40%;
|
171
|
+
max-width: 60%;
|
172
|
+
height: 100%;
|
173
|
+
object-fit: cover;
|
174
|
+
-webkit-mask-image: radial-gradient(circle farthest-side at top right, black 80%, transparent 98%);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
&__button {
|
179
|
+
position: absolute;
|
180
|
+
z-index: 2;
|
181
|
+
right: 0;
|
182
|
+
bottom: calc(56.25% / 2 - 25px);
|
183
|
+
left: 0;
|
184
|
+
margin: 0 auto;
|
185
|
+
|
186
|
+
@media (min-width: 38em) {
|
187
|
+
position: absolute;
|
188
|
+
top: 45%;
|
189
|
+
right: 20%;
|
190
|
+
bottom: unset;
|
191
|
+
left: unset;
|
192
|
+
}
|
193
|
+
}
|
160
194
|
}
|
161
195
|
}
|
162
196
|
|
@@ -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>
|
package/src/assets/js/app.js
CHANGED
@@ -3,9 +3,10 @@ import ClearForm from './imports/clear-form';
|
|
3
3
|
import Comparison from './imports/comparison';
|
4
4
|
import Gallery from './imports/gallery';
|
5
5
|
import HeroPattern from './imports/hero-pattern';
|
6
|
+
import HeroVideo from './imports/hero-video';
|
6
7
|
import ResponsiveTable from './imports/responsive-table';
|
7
|
-
import ScrollSpy from './imports/scroll-spy';
|
8
8
|
import ScrollbarWidth from './imports/scrollbar-width';
|
9
|
+
import ScrollSpy from './imports/scroll-spy';
|
9
10
|
import Tabs from './imports/tabs';
|
10
11
|
|
11
12
|
(() => {
|
@@ -21,8 +22,9 @@ import Tabs from './imports/tabs';
|
|
21
22
|
Comparison();
|
22
23
|
Gallery();
|
23
24
|
HeroPattern();
|
24
|
-
|
25
|
-
ScrollSpy();
|
25
|
+
HeroVideo();
|
26
26
|
ResponsiveTable();
|
27
27
|
ScrollbarWidth();
|
28
|
+
ScrollSpy();
|
29
|
+
Tabs();
|
28
30
|
})();
|
@@ -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;
|
@@ -52,54 +52,4 @@
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
}
|
55
|
-
}
|
56
|
-
|
57
|
-
.c-lightbox {
|
58
|
-
position: fixed;
|
59
|
-
z-index: 1000;
|
60
|
-
top: 0;
|
61
|
-
width: 100%;
|
62
|
-
height: 100%;
|
63
|
-
background-color: rgba(color('grey', 'step--1'), .9);
|
64
|
-
display: flex;
|
65
|
-
justify-content: center;
|
66
|
-
align-items: center;
|
67
|
-
|
68
|
-
&__slide {
|
69
|
-
max-width: 90vw;
|
70
|
-
margin: auto;
|
71
|
-
display: none;
|
72
|
-
|
73
|
-
&.active {
|
74
|
-
display: block;
|
75
|
-
|
76
|
-
img {
|
77
|
-
max-width: 85vw;
|
78
|
-
max-height: 90vh;
|
79
|
-
margin: auto;
|
80
|
-
display: block;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
&__prev,
|
86
|
-
&__next {
|
87
|
-
position: absolute;
|
88
|
-
height: 2rem;
|
89
|
-
width: 2rem;
|
90
|
-
background-repeat: no-repeat;
|
91
|
-
background-position: center;
|
92
|
-
padding: 0.5rem;
|
93
|
-
cursor: pointer;
|
94
|
-
}
|
95
|
-
|
96
|
-
&__prev {
|
97
|
-
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="arrow-left" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12H2M2 12L9 5M2 12L9 19" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>');
|
98
|
-
left: 0.5rem;
|
99
|
-
}
|
100
|
-
|
101
|
-
&__next {
|
102
|
-
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="arrow-right" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12H22M22 12L15 5M22 12L15 19" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>');
|
103
|
-
right: 0.5rem;
|
104
|
-
}
|
105
55
|
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
.c-lightbox {
|
2
|
+
position: fixed;
|
3
|
+
z-index: 1000;
|
4
|
+
top: 0;
|
5
|
+
width: 100%;
|
6
|
+
height: 100%;
|
7
|
+
background-color: rgba(color('grey', 'step--1'), .9);
|
8
|
+
display: flex;
|
9
|
+
justify-content: center;
|
10
|
+
align-items: center;
|
11
|
+
|
12
|
+
&__slide {
|
13
|
+
max-width: 90vw;
|
14
|
+
margin: auto;
|
15
|
+
display: none;
|
16
|
+
|
17
|
+
&.active {
|
18
|
+
display: block;
|
19
|
+
|
20
|
+
img {
|
21
|
+
max-width: 85vw;
|
22
|
+
max-height: 90vh;
|
23
|
+
margin: auto;
|
24
|
+
display: block;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
&__prev,
|
30
|
+
&__next {
|
31
|
+
position: absolute;
|
32
|
+
height: 2rem;
|
33
|
+
width: 2rem;
|
34
|
+
background-repeat: no-repeat;
|
35
|
+
background-position: center;
|
36
|
+
padding: 0.5rem;
|
37
|
+
cursor: pointer;
|
38
|
+
}
|
39
|
+
|
40
|
+
&__prev {
|
41
|
+
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="arrow-left" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12H2M2 12L9 5M2 12L9 19" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>');
|
42
|
+
left: 0.5rem;
|
43
|
+
}
|
44
|
+
|
45
|
+
&__next {
|
46
|
+
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="arrow-right" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12H22M22 12L15 5M22 12L15 19" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>');
|
47
|
+
right: 0.5rem;
|
48
|
+
}
|
49
|
+
|
50
|
+
&__close {
|
51
|
+
position: absolute;
|
52
|
+
top: 0.6rem;
|
53
|
+
right: 0.6rem;
|
54
|
+
color: color('white');
|
55
|
+
font-size: 1.6rem;
|
56
|
+
cursor: pointer;
|
57
|
+
}
|
58
|
+
|
59
|
+
&__video {
|
60
|
+
width: 100%;
|
61
|
+
}
|
62
|
+
}
|