mp-design-system 1.2.7 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/build/js/app.js +1 -1
- 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/comparison-table/comparison-table.config.js +39 -15
- package/src/_includes/components/comparison-table/comparison-table.njk +32 -11
- package/src/_includes/components/comparison-table/comparison-table.scss +138 -45
- package/src/assets/js/imports/comparison.js +10 -10
package/package.json
CHANGED
@@ -1,30 +1,50 @@
|
|
1
1
|
const products = [
|
2
2
|
{
|
3
3
|
title: 'Mastersizer 3000',
|
4
|
-
|
4
|
+
buttons: [
|
5
|
+
{
|
6
|
+
link: '#',
|
7
|
+
label: 'More details'
|
8
|
+
},
|
9
|
+
{
|
10
|
+
link: '#',
|
11
|
+
label: 'Request a quote'
|
12
|
+
}
|
13
|
+
],
|
5
14
|
image: {
|
6
15
|
src: '/static/img/range-product-1.jpg',
|
7
16
|
alt: 'Mastersizer 3000'
|
8
17
|
},
|
9
18
|
description: 'Delivering the data you need for outcomes you can trust',
|
10
19
|
sections: [
|
11
|
-
['0.01µm - 3500µm'],
|
12
|
-
[true],
|
13
|
-
[true, true]
|
20
|
+
['Laser diffraction', '0.01µm - 3500µm'],
|
21
|
+
[true, true, true, false],
|
22
|
+
[true, true, true, true, true],
|
23
|
+
['IQ/OQ validation', '21 CFR Part 11 support']
|
14
24
|
]
|
15
25
|
},
|
16
26
|
{
|
17
27
|
title: 'Mastersizer 3000E',
|
18
|
-
|
28
|
+
buttons: [
|
29
|
+
{
|
30
|
+
link: '#',
|
31
|
+
label: 'More details'
|
32
|
+
},
|
33
|
+
{
|
34
|
+
link: '#',
|
35
|
+
label: 'Request a quote'
|
36
|
+
}
|
37
|
+
],
|
19
38
|
image: {
|
20
39
|
src: '/static/img/range-product-2.jpg',
|
21
40
|
alt: 'Mastersizer 3000E'
|
22
41
|
},
|
23
42
|
description: 'Entry level particle size analyzer',
|
24
43
|
sections: [
|
25
|
-
['0.1µm - 1000µm'],
|
26
|
-
[true],
|
27
|
-
[true, false]
|
44
|
+
['Laser diffraction', '0.1µm - 1000µm'],
|
45
|
+
[false, false, true, true],
|
46
|
+
[true, false, false, false, false],
|
47
|
+
['-', '-']
|
28
48
|
]
|
29
49
|
}
|
30
50
|
]
|
@@ -36,17 +56,22 @@ module.exports = {
|
|
36
56
|
},
|
37
57
|
context: {
|
38
58
|
sections: [
|
39
|
-
{
|
40
|
-
rows: ['Particle size range']
|
41
|
-
},
|
42
59
|
{
|
43
60
|
title: 'Technology',
|
44
|
-
rows: ['
|
61
|
+
rows: ['Technology', 'Particle size range']
|
45
62
|
},
|
46
63
|
{
|
47
64
|
title: 'Dispersion type',
|
48
|
-
rows: ['
|
49
|
-
}
|
65
|
+
rows: ['Automated wet', 'Automated dry powder', 'Manual wet', 'Manual dry powder']
|
66
|
+
},
|
67
|
+
{
|
68
|
+
title: 'Software',
|
69
|
+
rows: ['Basic software', 'Advanced method development', 'Comparison software', 'Advanced data quality assessment', 'Reporting']
|
70
|
+
},
|
71
|
+
{
|
72
|
+
title: 'Compliance',
|
73
|
+
rows: ['Installation', 'Compliance']
|
74
|
+
},
|
50
75
|
],
|
51
76
|
products: [
|
52
77
|
...products
|
@@ -60,7 +85,6 @@ module.exports = {
|
|
60
85
|
...products,
|
61
86
|
...products,
|
62
87
|
...products,
|
63
|
-
...products,
|
64
88
|
]
|
65
89
|
}
|
66
90
|
}
|
@@ -1,21 +1,39 @@
|
|
1
1
|
{% from "components/button/macro.njk" import button %}
|
2
2
|
{% from "components/icon/macro.njk" import icon %}
|
3
3
|
|
4
|
-
<
|
5
|
-
<div class="c-
|
6
|
-
<div class="c-
|
7
|
-
<table class="c-
|
4
|
+
<section id="product-comparison-table" class="mp u-bg-grey-step-3 u-pad-bottom-l">
|
5
|
+
<div class="c-comparison-table__mobile u-wrap"></div>
|
6
|
+
<div class="c-comparison-table__desktop u-wrap">
|
7
|
+
<table class="c-comparison-table">
|
8
8
|
<thead>
|
9
9
|
<tr>
|
10
10
|
<th></th>
|
11
11
|
{% for product in params.products %}
|
12
12
|
<th>
|
13
|
-
<
|
13
|
+
<div class="c-comparison-table__product">
|
14
14
|
<img alt="{{ product.image.alt }}" src="{{ product.image.src }}" />
|
15
15
|
<h3 class="c-h c-h--step-0">{{ product.title }}</h3>
|
16
16
|
<p>{{ product.description }}</p>
|
17
|
-
|
18
|
-
|
17
|
+
</div>
|
18
|
+
</th>
|
19
|
+
{% endfor %}
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<th></th>
|
23
|
+
{% for product in params.products %}
|
24
|
+
<th>
|
25
|
+
{% if product.buttons | length %}
|
26
|
+
<div class="c-comparison-table__buttons">
|
27
|
+
{% for item in product.buttons %}
|
28
|
+
{{ button({
|
29
|
+
link: item.link,
|
30
|
+
label: item.label,
|
31
|
+
colour: 'outline-green' if loop.index0 == 0 else 'green',
|
32
|
+
classes: 'c-button--small'
|
33
|
+
}) }}
|
34
|
+
{% endfor %}
|
35
|
+
</div>
|
36
|
+
{% endif %}
|
19
37
|
</th>
|
20
38
|
{% endfor %}
|
21
39
|
</tr>
|
@@ -23,8 +41,11 @@
|
|
23
41
|
<tbody>
|
24
42
|
{% for section in params.sections %}
|
25
43
|
{% if section.title != null %}
|
26
|
-
<tr class="c-table__title">
|
27
|
-
<th
|
44
|
+
<tr class="c-comparison-table__title">
|
45
|
+
<th>
|
46
|
+
<span>{{ section.title }}</span>
|
47
|
+
</th>
|
48
|
+
<th colspan="{{ params.products | length }}"></th>
|
28
49
|
</tr>
|
29
50
|
{% endif %}
|
30
51
|
|
@@ -39,7 +60,7 @@
|
|
39
60
|
{% if value == true %}
|
40
61
|
{{ icon({ id: 'tick' }) }}
|
41
62
|
{% elseif value == false %}
|
42
|
-
{{ icon({ id: '
|
63
|
+
{{ icon({ id: 'cross' }) }}
|
43
64
|
{% else %}
|
44
65
|
{{ value }}
|
45
66
|
{% endif %}
|
@@ -52,4 +73,4 @@
|
|
52
73
|
</tbody>
|
53
74
|
</table>
|
54
75
|
</div>
|
55
|
-
</
|
76
|
+
</section>
|
@@ -1,44 +1,145 @@
|
|
1
|
-
.c-comparison {
|
2
|
-
|
3
|
-
|
1
|
+
.c-comparison-table__desktop {
|
2
|
+
overflow: auto;
|
3
|
+
width: 100%;
|
4
4
|
|
5
|
-
|
6
|
-
overflow: auto;
|
7
|
-
width: 100%;
|
8
|
-
}
|
9
|
-
|
10
|
-
&__wrapper .c-table {
|
5
|
+
.c-comparison-table {
|
11
6
|
width: calc(100% - 1px);
|
12
|
-
// min-width: $wrapper;
|
13
7
|
|
14
8
|
@media (min-width: 60em) {
|
15
|
-
min-width: $wrapper;
|
16
|
-
|
17
9
|
tbody > tr > :first-child {
|
18
10
|
min-width: 300px;
|
19
11
|
}
|
20
12
|
}
|
21
13
|
}
|
14
|
+
}
|
22
15
|
|
23
|
-
|
24
|
-
|
16
|
+
.c-comparison-table__mobile {
|
17
|
+
display: none;
|
18
|
+
|
19
|
+
& > * + * {
|
20
|
+
@include margin-top('m-l');
|
25
21
|
}
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
.c-comparison-table {
|
24
|
+
width: 100%;
|
25
|
+
table-layout: fixed;
|
26
|
+
|
27
|
+
&__product {
|
28
|
+
img {
|
29
|
+
@include margin(0);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
.c-comparison-table {
|
36
|
+
@include step(-1);
|
37
|
+
border-collapse: collapse;
|
38
|
+
|
39
|
+
thead {
|
40
|
+
th {
|
41
|
+
@include padding(0, '2xs');
|
42
|
+
border: 0;
|
43
|
+
text-align: center;
|
44
|
+
vertical-align: top;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
&__product {
|
49
|
+
@extend .u-flow--2xs;
|
50
|
+
|
51
|
+
img {
|
52
|
+
@include space('max-height', '3xl');
|
53
|
+
@include margin(0, 'auto');
|
54
|
+
object-fit: contain;
|
55
|
+
mix-blend-mode: multiply;
|
56
|
+
}
|
57
|
+
|
58
|
+
p {
|
59
|
+
font-weight: 400;
|
60
|
+
}
|
31
61
|
}
|
62
|
+
|
63
|
+
&__buttons {
|
64
|
+
@include margin(0, 'auto');
|
65
|
+
@include padding-bottom('xs');
|
66
|
+
margin-top: 1.25rem !important;
|
67
|
+
display: inline-flex;
|
68
|
+
flex-direction: column;
|
32
69
|
|
33
|
-
|
34
|
-
|
70
|
+
& * + * {
|
71
|
+
@include margin-top('2xs');
|
72
|
+
}
|
73
|
+
}
|
35
74
|
|
36
|
-
|
37
|
-
|
75
|
+
&__title {
|
76
|
+
th {
|
77
|
+
@include padding-top('xs');
|
78
|
+
text-align: left;
|
79
|
+
|
80
|
+
span {
|
81
|
+
@include padding('2xs');
|
82
|
+
background-color: color('grey');
|
83
|
+
color: color('white');
|
84
|
+
max-width: 20em;
|
85
|
+
width: 100%;
|
86
|
+
display: inline-block;
|
87
|
+
position: relative;
|
88
|
+
text-align: center;
|
89
|
+
font-weight: 600;
|
90
|
+
|
91
|
+
&::after {
|
92
|
+
@include space('border-width', 'xs', 0, 0, 'xs');
|
93
|
+
content: "";
|
94
|
+
width: 0;
|
95
|
+
height: 0;
|
96
|
+
border-style: solid;
|
97
|
+
border-color: color('grey', 'step-3') transparent transparent transparent;
|
98
|
+
position: absolute;
|
99
|
+
top: 0;
|
100
|
+
right: 0;
|
101
|
+
}
|
102
|
+
}
|
38
103
|
}
|
104
|
+
}
|
39
105
|
|
40
|
-
|
41
|
-
|
106
|
+
tbody {
|
107
|
+
tr {
|
108
|
+
&:first-child th {
|
109
|
+
@include padding(0);
|
110
|
+
vertical-align: bottom;
|
111
|
+
}
|
112
|
+
|
113
|
+
&:not(.c-comparison-table__title) {
|
114
|
+
height: 48px;
|
115
|
+
}
|
116
|
+
|
117
|
+
td:first-child {
|
118
|
+
text-align: left;
|
119
|
+
font-weight: 600;
|
120
|
+
}
|
121
|
+
|
122
|
+
td {
|
123
|
+
@include padding('2xs');
|
124
|
+
background-color: color('white');
|
125
|
+
border: 2px solid color('grey', 'step-3');
|
126
|
+
border-right: 0;
|
127
|
+
border-left: 0;
|
128
|
+
text-align: center;
|
129
|
+
vertical-align: middle;
|
130
|
+
|
131
|
+
.c-icon {
|
132
|
+
font-size: 1.5rem;
|
133
|
+
}
|
134
|
+
|
135
|
+
.c-icon--tick {
|
136
|
+
color: color('green');
|
137
|
+
}
|
138
|
+
|
139
|
+
.c-icon--cross {
|
140
|
+
color: color('grey', 'step-2');
|
141
|
+
}
|
142
|
+
}
|
42
143
|
}
|
43
144
|
}
|
44
145
|
|
@@ -47,48 +148,40 @@
|
|
47
148
|
display: block;
|
48
149
|
}
|
49
150
|
|
50
|
-
&
|
151
|
+
&__desktop {
|
51
152
|
display: none;
|
52
153
|
}
|
53
154
|
}
|
54
|
-
|
55
|
-
thead img {
|
56
|
-
@include space('max-height', '3xl');
|
57
|
-
object-fit: contain;
|
58
|
-
}
|
59
|
-
|
60
155
|
}
|
61
156
|
|
62
157
|
@media only screen and (min-width: 640px) {
|
63
|
-
|
64
|
-
.c-table
|
65
|
-
.c-table--comparison thead th:nth-last-child(1):nth-child(2) ~ th {
|
158
|
+
.c-comparison-table thead th:nth-last-child(1):nth-child(2),
|
159
|
+
.c-comparison-table thead th:nth-last-child(1):nth-child(2) ~ th {
|
66
160
|
width: 85%;
|
67
161
|
}
|
68
162
|
|
69
|
-
.c-table
|
70
|
-
.c-table
|
163
|
+
.c-comparison-table thead th:nth-last-child(2):nth-child(2),
|
164
|
+
.c-comparison-table thead th:nth-last-child(2):nth-child(2) ~ th {
|
71
165
|
width: 42.5%;
|
72
166
|
}
|
73
167
|
|
74
|
-
.c-table
|
75
|
-
.c-table
|
168
|
+
.c-comparison-table thead th:nth-last-child(3):nth-child(2),
|
169
|
+
.c-comparison-table thead th:nth-last-child(3):nth-child(2) ~ th {
|
76
170
|
width: 28.33333%;
|
77
171
|
}
|
78
172
|
|
79
|
-
.c-table
|
80
|
-
.c-table
|
173
|
+
.c-comparison-table thead th:nth-last-child(4):nth-child(2),
|
174
|
+
.c-comparison-table thead th:nth-last-child(4):nth-child(2) ~ th {
|
81
175
|
width: 21.25%;
|
82
176
|
}
|
83
177
|
|
84
|
-
.c-table
|
85
|
-
.c-table
|
178
|
+
.c-comparison-table thead th:nth-last-child(5):nth-child(2),
|
179
|
+
.c-comparison-table thead th:nth-last-child(5):nth-child(2) ~ th {
|
86
180
|
width: 17%;
|
87
181
|
}
|
88
182
|
|
89
|
-
.c-table
|
90
|
-
.c-table
|
183
|
+
.c-comparison-table thead th:nth-last-child(6):nth-child(2),
|
184
|
+
.c-comparison-table thead th:nth-last-child(6):nth-child(2) ~ th {
|
91
185
|
width: 14.16667%;
|
92
186
|
}
|
93
|
-
|
94
187
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
function Comparison() {
|
2
|
-
document.querySelectorAll('.c-comparison').
|
2
|
+
console.log(document.querySelectorAll('.c-comparison-table').parentElement)
|
3
|
+
document.querySelectorAll('.c-comparison-table').forEach(extractMobileComparison)
|
3
4
|
}
|
4
5
|
|
5
6
|
function extractMobileComparison(container) {
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const parent = container.parentNode.parentNode;
|
8
|
+
const body = parent.querySelector('.c-comparison-table tbody');
|
9
|
+
const head = parent.querySelector('.c-comparison-table thead');
|
10
|
+
const mobile = parent.parentElement.querySelector('.c-comparison-table__mobile');
|
9
11
|
|
10
12
|
if (!body || !head || !mobile) return;
|
11
13
|
|
@@ -16,7 +18,7 @@ function extractMobileComparison(container) {
|
|
16
18
|
|
17
19
|
Array.from(body.children).forEach(row => {
|
18
20
|
// For table row headers, push to all products
|
19
|
-
if (row.classList.contains('c-table__title')) {
|
21
|
+
if (row.classList.contains('c-comparison-table__title')) {
|
20
22
|
products.forEach(x => {
|
21
23
|
x.table.push({ type: 'title', title: row.children[0].textContent })
|
22
24
|
})
|
@@ -43,13 +45,11 @@ function extractMobileComparison(container) {
|
|
43
45
|
|
44
46
|
function createMobileProduct(product) {
|
45
47
|
const parent = document.createElement('article');
|
46
|
-
parent.innerHTML =
|
47
|
-
|
48
|
-
</div>
|
49
|
-
<table class="c-table">
|
48
|
+
parent.innerHTML = `${product.info}
|
49
|
+
<table class="c-comparison-table">
|
50
50
|
${product.table.map(x => {
|
51
51
|
if (x.type === 'title') {
|
52
|
-
return `<tr class="c-table__title"><th
|
52
|
+
return `<tr class="c-comparison-table__title"><th><span>${x.title}</span></th><th></th></tr>`;
|
53
53
|
} else {
|
54
54
|
return `<tr>
|
55
55
|
<td>${x.key}</td>
|