cec-nuxt-lib 0.3.6 → 0.3.8
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/dist/module.json +1 -1
- package/dist/runtime/components/cecCanvas.vue +305 -197
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -3,23 +3,14 @@ import { onMounted } from 'vue';
|
|
|
3
3
|
import { useState } from '#app';
|
|
4
4
|
|
|
5
5
|
import { createRenderer, text } from '@contensis/canvas-html';
|
|
6
|
-
|
|
7
6
|
import type { Block } from '@contensis/canvas-html';
|
|
8
|
-
|
|
9
|
-
const sizeString = (n) => {
|
|
10
|
-
if (n < 1000) {
|
|
11
|
-
return `${n}B`;
|
|
12
|
-
} else if (n < 1000 * 1000) {
|
|
13
|
-
return `${(n / 1000).toFixed(2)}KB`;
|
|
14
|
-
} else {
|
|
15
|
-
return `${(n / 1000 / 1000).toFixed(2)}MB`;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
7
|
+
const getCanvas = (data: Block[]) => renderer({ data });
|
|
18
8
|
|
|
19
9
|
const baseUrl = useState('baseUrl');
|
|
20
|
-
const getCanvas = (data: Block[]) => renderer({ data });
|
|
21
10
|
const listItems = useState('listItems');
|
|
11
|
+
const path = useState('path');
|
|
22
12
|
const questions = useState('questions', () => []);
|
|
13
|
+
const title = useState('title');
|
|
23
14
|
let canvasHtml;
|
|
24
15
|
|
|
25
16
|
const props = defineProps({
|
|
@@ -31,6 +22,16 @@ const props = defineProps({
|
|
|
31
22
|
|
|
32
23
|
const { canvas } = props;
|
|
33
24
|
|
|
25
|
+
const sizeString = (n) => {
|
|
26
|
+
if (n < 1000) {
|
|
27
|
+
return `${n}B`;
|
|
28
|
+
} else if (n < 1000 * 1000) {
|
|
29
|
+
return `${(n / 1000).toFixed(2)}KB`;
|
|
30
|
+
} else {
|
|
31
|
+
return `${(n / 1000 / 1000).toFixed(2)}MB`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
34
35
|
const regex =
|
|
35
36
|
/^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
|
|
36
37
|
|
|
@@ -82,7 +83,7 @@ const anchor = (data) => {
|
|
|
82
83
|
|
|
83
84
|
const carousel = (data, id) => {
|
|
84
85
|
// Create the indicators
|
|
85
|
-
let indicators = data.carouselComponent.reduce((acc,
|
|
86
|
+
let indicators = data.carouselComponent.reduce((acc, _, i) => {
|
|
86
87
|
return (
|
|
87
88
|
acc +
|
|
88
89
|
`<button type="button" data-bs-target="#${id}-indicators" data-bs-slide-to="${i}" class="${i ? '' : 'active'}" aria-current="${i ? '' : 'true'}" aria-label="Slide ${i}">${i + 1}</button>`
|
|
@@ -169,6 +170,46 @@ const centralColumn = (props: any) => {
|
|
|
169
170
|
}
|
|
170
171
|
};
|
|
171
172
|
|
|
173
|
+
const centralPromotionalSection = (props: any) => {
|
|
174
|
+
let item = props.block?.value;
|
|
175
|
+
return `
|
|
176
|
+
<div class="row">
|
|
177
|
+
<div class="py-5 bg-cec-central-promo-section">
|
|
178
|
+
<div class="cec-meta-outer px-4">
|
|
179
|
+
<div class="cec-meta-content col-lg-8 col-md-12 px-3 py-4 px-md-5">
|
|
180
|
+
<div>${item.content}</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
`;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const contactDetails = (data) => {
|
|
189
|
+
let address = data.buildingName ? `<p class="mb-0">${data.buildingName}` : '';
|
|
190
|
+
address += data.streetAddress
|
|
191
|
+
? makeAddressItem('streetAddress', data.streetAddress)
|
|
192
|
+
: '';
|
|
193
|
+
address += data.locality
|
|
194
|
+
? makeAddressItem('addressLocality', data.locality)
|
|
195
|
+
: '';
|
|
196
|
+
address += data.county ? makeAddressItem('addressRegion', data.county) : '';
|
|
197
|
+
address += data.postCode ? makeAddressItem('postalCode', data.postCode) : '';
|
|
198
|
+
let contact = data.phoneNumber
|
|
199
|
+
? makeAddressItem('telephone', data.phoneNumber)
|
|
200
|
+
: '';
|
|
201
|
+
contact += data.email ? makeAddressItem('email', data.email) : '';
|
|
202
|
+
return `
|
|
203
|
+
<div itemscope itemtype="https://schema.org/Organization">
|
|
204
|
+
${makeAddressItem('name', data.name)}
|
|
205
|
+
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
|
|
206
|
+
${address}
|
|
207
|
+
</div>
|
|
208
|
+
${contact}
|
|
209
|
+
</div>
|
|
210
|
+
`;
|
|
211
|
+
};
|
|
212
|
+
|
|
172
213
|
const container = (data) => {
|
|
173
214
|
if (data.closeContainer) {
|
|
174
215
|
return `</div>${data.singleChoice === 'cec-main-column' ? '</div>' : ''}`;
|
|
@@ -181,10 +222,10 @@ const container = (data) => {
|
|
|
181
222
|
`;
|
|
182
223
|
};
|
|
183
224
|
|
|
184
|
-
const
|
|
225
|
+
const fullWidthImageWithOverlay = (props: any) => {
|
|
185
226
|
let item = props.block?.value;
|
|
186
227
|
let overlay;
|
|
187
|
-
if (
|
|
228
|
+
if (item.overlayImage) {
|
|
188
229
|
overlay = `
|
|
189
230
|
<div class="cec-cent-promo-txt-wrap top-50 end-0">
|
|
190
231
|
<div
|
|
@@ -197,7 +238,7 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
|
|
|
197
238
|
/>
|
|
198
239
|
</div>
|
|
199
240
|
</div>`;
|
|
200
|
-
} else {
|
|
241
|
+
} else if (item.overlayText) {
|
|
201
242
|
overlay = `
|
|
202
243
|
<div class="position-relative">
|
|
203
244
|
<div class="row g-0">
|
|
@@ -211,17 +252,19 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
|
|
|
211
252
|
<div
|
|
212
253
|
class="cec-cent-promo-txt bg-tog-for-chil-green col-lg-8 col-md-12 mx-auto my-md-4 mb-md-5 pb-2"
|
|
213
254
|
>
|
|
214
|
-
<div class="text-white text-center p-
|
|
255
|
+
<div class="text-white text-center p-3">${item.overlayText}</div>
|
|
215
256
|
</div>
|
|
216
257
|
</div>
|
|
217
258
|
</div>
|
|
218
259
|
</div>
|
|
219
260
|
</div>
|
|
220
261
|
`;
|
|
262
|
+
} else {
|
|
263
|
+
overlay = '';
|
|
221
264
|
}
|
|
222
265
|
return `
|
|
223
266
|
<div class="position-relative">
|
|
224
|
-
<div class="row g-0
|
|
267
|
+
<div class="row g-0">
|
|
225
268
|
<img
|
|
226
269
|
class="img-fluid"
|
|
227
270
|
alt="${item.image.altText}"
|
|
@@ -233,137 +276,23 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
|
|
|
233
276
|
`;
|
|
234
277
|
};
|
|
235
278
|
|
|
236
|
-
const
|
|
237
|
-
let item = props.block?.value;
|
|
238
|
-
const bgClass = `bg-${item.colour.toLowerCase().replace(/\s/g, '-')}`;
|
|
239
|
-
let textCol = `
|
|
240
|
-
<div class="p-2 ps-lg-4 ms-lg-5 col">
|
|
241
|
-
<div class="cec-pull-column pe-md-5">${item.content}</div>
|
|
242
|
-
</div>`;
|
|
243
|
-
let imageCol = `
|
|
244
|
-
<div class="col">
|
|
245
|
-
<img
|
|
246
|
-
class="img-fluid"
|
|
247
|
-
alt="${item.image.altText}"
|
|
248
|
-
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
249
|
-
/>
|
|
250
|
-
</div>`;
|
|
251
|
-
return `
|
|
252
|
-
<div
|
|
253
|
-
class="${bgClass} cec-pull-container pe-md-0 d-flex flex-column flex-md-row justify-content-center ps-4 align-items-center py-5 mb-4"
|
|
254
|
-
>
|
|
255
|
-
${item.alignment === 'left' ? imageCol + textCol : textCol + imageCol}
|
|
256
|
-
</div>
|
|
257
|
-
`;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
const promotionalFullWidthImageWithSideOverlay = (props: any) => {
|
|
279
|
+
const fullWidthImageWithSideOverlay = (props: any) => {
|
|
261
280
|
let item = props.block?.value;
|
|
262
281
|
return `
|
|
263
282
|
<div class="position-relative side-overlay-section">
|
|
264
283
|
<div class="row g-0">
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
>
|
|
274
|
-
<h2 class="text-white promo-heading display-6">${item.heading}</h2>
|
|
275
|
-
<div class="text-white">${item.content}</div>
|
|
276
|
-
</div>
|
|
284
|
+
<img
|
|
285
|
+
class="img-fluid"
|
|
286
|
+
alt="${item.image.altText}"
|
|
287
|
+
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
288
|
+
/>
|
|
289
|
+
<div style="position: absolute;" class="my-side-overlay col-lg-6 bg-cec-green ms-lg-5 mt-lg-5 p-2 top-0 ">
|
|
290
|
+
<h2 class="text-white promo-heading display-6">${item.heading}</h2>
|
|
291
|
+
<div class="text-white "> ${item.content}</div>
|
|
277
292
|
</div>
|
|
278
|
-
</div>
|
|
279
|
-
`;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
const centralPromotionalSection = (props: any) => {
|
|
283
|
-
let item = props.block?.value;
|
|
284
|
-
return `
|
|
285
|
-
<div class="row">
|
|
286
|
-
<div class="py-5 bg-cec-central-promo-section">
|
|
287
|
-
<div class="cec-meta-outer px-4">
|
|
288
|
-
<div class="cec-meta-content col-lg-8 col-md-12 px-3 py-4 px-md-5">
|
|
289
|
-
<div>${item.content}</div>
|
|
290
|
-
</div>
|
|
291
293
|
</div>
|
|
292
294
|
</div>
|
|
293
|
-
</div>
|
|
294
|
-
`;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const promotionalBannerWithText = (props: any) => {
|
|
298
|
-
let item = props.block?.value;
|
|
299
|
-
let overlay = `
|
|
300
|
-
<div class="cec-cent-promo-txt-wrap col-md-11 top-50 w-100 text-center">
|
|
301
|
-
<h1
|
|
302
|
-
class="mb-0 cec-cent-promo-txt d-md-inline-block px-3 pt-1 pb-3 promo-heading bg-cec-green text-white"
|
|
303
|
-
>
|
|
304
|
-
${item.text}
|
|
305
|
-
</h1>
|
|
306
|
-
</div>
|
|
307
295
|
`;
|
|
308
|
-
let paras = item.html.replace(/<\/?p>/g, '').split('\n');
|
|
309
|
-
if (paras.length) {
|
|
310
|
-
overlay = `
|
|
311
|
-
<div
|
|
312
|
-
class="cec-cent-promo-txt-wrap col-lg-8 col-md-11 text-center top-50 w-100 "
|
|
313
|
-
>
|
|
314
|
-
<div id="overlay" class="bg-tog-for-chil-green d-md-inline-block py-3 px-4 ">
|
|
315
|
-
<h1
|
|
316
|
-
class="hp-promo-heading text-white d-md-inline-block display-md-5 text-center px-3 pt-1 pb-0"
|
|
317
|
-
style="font-family: myriad-pro, sans-serif"
|
|
318
|
-
>
|
|
319
|
-
${paras[0]}
|
|
320
|
-
</h1>
|
|
321
|
-
<div class="d-flex justify-content-center mt-2 strapline text-white">
|
|
322
|
-
${paras[1]}
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
</div>`;
|
|
326
|
-
}
|
|
327
|
-
return `
|
|
328
|
-
<div class="position-relative row g-0 mb-3">
|
|
329
|
-
<img
|
|
330
|
-
alt="${item.bannerImage.altText}"
|
|
331
|
-
src="${baseUrl.value}${item.bannerImage.asset.sys.uri}"
|
|
332
|
-
/>
|
|
333
|
-
${overlay}
|
|
334
|
-
</div>
|
|
335
|
-
`;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const processUri = (uri) => {
|
|
339
|
-
return uri.toLowerCase().replace(/%e2/g, '%E2');
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const genericList = (props: any) => {
|
|
343
|
-
let item = props.block?.value;
|
|
344
|
-
let id = props.block.id;
|
|
345
|
-
return listItems.value[id]
|
|
346
|
-
? `
|
|
347
|
-
<h2 class="fs-4 mt-3">${item.title}</h2>
|
|
348
|
-
<ul>
|
|
349
|
-
${listItems.value[id].reduce((acc, e) => {
|
|
350
|
-
return e.sys.dataFormat === 'webpage'
|
|
351
|
-
? `${acc}
|
|
352
|
-
<li><a href="${processUri(e.sys.uri)}">${e.title}</a></li>
|
|
353
|
-
`
|
|
354
|
-
: `${acc}
|
|
355
|
-
<li>
|
|
356
|
-
<a href="${processUri(e.sys.uri)}"
|
|
357
|
-
>${e.title[0].toUpperCase()}${e.title.slice(1)}
|
|
358
|
-
(${e.sys.contentTypeId.toUpperCase()},
|
|
359
|
-
${sizeString(e.sys.properties.fileSize)})
|
|
360
|
-
</a>
|
|
361
|
-
</li>
|
|
362
|
-
`;
|
|
363
|
-
}, '')}
|
|
364
|
-
</ul>
|
|
365
|
-
`
|
|
366
|
-
: '';
|
|
367
296
|
};
|
|
368
297
|
|
|
369
298
|
const heroUnit = (props: any) => {
|
|
@@ -374,8 +303,8 @@ const heroUnit = (props: any) => {
|
|
|
374
303
|
const horizontalTable = (props: any) => {
|
|
375
304
|
let data = props.block?.value;
|
|
376
305
|
let rows = data.tableRow.reduce((acc, r) => {
|
|
377
|
-
let cols = r.columns.reduce((
|
|
378
|
-
return `<td>${c}</td>`;
|
|
306
|
+
let cols = r.columns.reduce((acc1, c) => {
|
|
307
|
+
return acc1 + `<td>${c}</td>`;
|
|
379
308
|
}, '');
|
|
380
309
|
return `${acc}<tr><th scope="row">${r.headerCell}</th>${cols}</tr>`;
|
|
381
310
|
}, '');
|
|
@@ -383,10 +312,10 @@ const horizontalTable = (props: any) => {
|
|
|
383
312
|
<div class="table-responsive">
|
|
384
313
|
<table class="usr_TableDefault">
|
|
385
314
|
<caption class="hidden">${data.caption}</caption>
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
315
|
+
<tbody>
|
|
316
|
+
${rows}
|
|
317
|
+
</tbody>
|
|
318
|
+
</table>
|
|
390
319
|
</div>
|
|
391
320
|
`;
|
|
392
321
|
};
|
|
@@ -409,6 +338,63 @@ const linkEntry = (data) => {
|
|
|
409
338
|
return `<a title="${data.title || ''}" href="${data.target}">${data.text}</a>`;
|
|
410
339
|
};
|
|
411
340
|
|
|
341
|
+
const makeAddressItem = (prop, text) => {
|
|
342
|
+
if (prop === 'email') {
|
|
343
|
+
return `<p class="mb-0"> <a href="mailto:${text}" itemprop="${prop}>${text}</a></p>`;
|
|
344
|
+
}
|
|
345
|
+
return `<p class="mb-0" itemprop="${prop}">${text}</p>`;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const makeQuestions = (data, id) => {
|
|
349
|
+
data.question.forEach((qu, j) => {
|
|
350
|
+
qu.stack = [0];
|
|
351
|
+
qu.buttons = qu.responseForQuestionComponent.reduce((acc, r, i) => {
|
|
352
|
+
return (
|
|
353
|
+
acc +
|
|
354
|
+
`<div class="col w-auto ps-0 pe-3">
|
|
355
|
+
<button
|
|
356
|
+
type="button"
|
|
357
|
+
id="${id}_${j}_${i}"
|
|
358
|
+
class="cec-button question-btns"
|
|
359
|
+
>
|
|
360
|
+
${r.buttonText}
|
|
361
|
+
</button>
|
|
362
|
+
</div>`
|
|
363
|
+
);
|
|
364
|
+
}, '');
|
|
365
|
+
questions.value.push({ id: id, question: data.question, stack: [0] });
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
let buttons = data.question[0].buttons;
|
|
369
|
+
return `
|
|
370
|
+
<div class="mt-3 questions">
|
|
371
|
+
<h2>Answer the questions:</h2>
|
|
372
|
+
<fieldset class="p-1 mb-3">
|
|
373
|
+
<legend>${data.entryTitle}</legend>
|
|
374
|
+
<div class="ps-2 align-items-end question row g-0">
|
|
375
|
+
<div id="${id}_display">${data.question[0].question}</div>
|
|
376
|
+
<div class="row row-cols-auto btns-div" id="${id}_buttons">
|
|
377
|
+
${buttons}
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
<button
|
|
381
|
+
type="button"
|
|
382
|
+
class="mt-4 btn btn-light previous"
|
|
383
|
+
id="${id}_prev"
|
|
384
|
+
>
|
|
385
|
+
Previous question
|
|
386
|
+
</button>
|
|
387
|
+
<button
|
|
388
|
+
type="button"
|
|
389
|
+
class="mt-4 btn btn-light reset"
|
|
390
|
+
id="${id}_reset"
|
|
391
|
+
>
|
|
392
|
+
Restart
|
|
393
|
+
</button>
|
|
394
|
+
</fieldset>
|
|
395
|
+
</div>`;
|
|
396
|
+
};
|
|
397
|
+
|
|
412
398
|
const processTime = (str) => {
|
|
413
399
|
let suffix = 'am';
|
|
414
400
|
if (str === '00:00') {
|
|
@@ -472,6 +458,174 @@ const openingHours = (data) => {
|
|
|
472
458
|
`;
|
|
473
459
|
};
|
|
474
460
|
|
|
461
|
+
const promotionalBannerWithText = (props: any) => {
|
|
462
|
+
let item = props.block?.value;
|
|
463
|
+
let overlay = `
|
|
464
|
+
<div class="cec-cent-promo-txt-wrap col-md-11 top-50 w-100 text-center">
|
|
465
|
+
<h1
|
|
466
|
+
class="mb-0 cec-cent-promo-txt d-md-inline-block px-3 pt-1 pb-3 promo-heading bg-cec-green text-white"
|
|
467
|
+
>
|
|
468
|
+
${item.text}
|
|
469
|
+
</h1>
|
|
470
|
+
</div>
|
|
471
|
+
`;
|
|
472
|
+
let paras = item.html.replace(/<\/?p>/g, '').split('\n');
|
|
473
|
+
if (paras.length) {
|
|
474
|
+
overlay = `
|
|
475
|
+
<div
|
|
476
|
+
class="cec-cent-promo-txt-wrap col-lg-8 col-md-11 text-center top-50 w-100 "
|
|
477
|
+
>
|
|
478
|
+
<div id="overlay" class="bg-tog-for-chil-green d-md-inline-block py-3 px-4 ">
|
|
479
|
+
<h1
|
|
480
|
+
class="hp-promo-heading text-white d-md-inline-block display-md-5 text-center px-3 pt-1 pb-0"
|
|
481
|
+
style="font-family: myriad-pro, sans-serif"
|
|
482
|
+
>
|
|
483
|
+
${paras[0]}
|
|
484
|
+
</h1>
|
|
485
|
+
<div class="d-flex justify-content-center mt-2 strapline text-white">
|
|
486
|
+
${paras[1]}
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
</div>`;
|
|
490
|
+
}
|
|
491
|
+
return `
|
|
492
|
+
<div class="position-relative row g-0 mb-3">
|
|
493
|
+
<img
|
|
494
|
+
alt="${item.bannerImage.altText}"
|
|
495
|
+
src="${baseUrl.value}${item.bannerImage.asset.sys.uri}"
|
|
496
|
+
/>
|
|
497
|
+
${overlay}
|
|
498
|
+
</div>
|
|
499
|
+
`;
|
|
500
|
+
};
|
|
501
|
+
const promotionalContrastRegion = (props: any) => {
|
|
502
|
+
let item = props.block?.value;
|
|
503
|
+
const bgClass = `bg-${item.colour.toLowerCase().replace(/\s/g, '-')}`;
|
|
504
|
+
let textCol = `
|
|
505
|
+
<div class="p-2 ps-lg-4 ms-lg-5 col">
|
|
506
|
+
<div class="cec-pull-column pe-md-5">${item.content}</div>
|
|
507
|
+
</div>`;
|
|
508
|
+
let imageCol = `
|
|
509
|
+
<div class="col">
|
|
510
|
+
<img
|
|
511
|
+
class="img-fluid"
|
|
512
|
+
alt="${item.image.altText}"
|
|
513
|
+
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
514
|
+
/>
|
|
515
|
+
</div>`;
|
|
516
|
+
return `
|
|
517
|
+
<div
|
|
518
|
+
class="${bgClass} cec-pull-container pe-md-0 d-flex flex-column flex-md-row justify-content-center ps-4 align-items-center py-5 mb-4"
|
|
519
|
+
>
|
|
520
|
+
${item.alignment === 'left' ? imageCol + textCol : textCol + imageCol}
|
|
521
|
+
</div>
|
|
522
|
+
`;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
const promotionalFullWidthImageWithOverlay = (props: any) => {
|
|
526
|
+
let item = props.block?.value;
|
|
527
|
+
let overlay;
|
|
528
|
+
if (!item.overlayText) {
|
|
529
|
+
overlay = `
|
|
530
|
+
<div class="cec-cent-promo-txt-wrap top-50 end-0">
|
|
531
|
+
<div
|
|
532
|
+
class="cec-cent-promo-txt text-center bg-tog-for-chil-green col-lg-8 col-md-10 mx-auto my-md-4 mb-md-5 pb-2"
|
|
533
|
+
>
|
|
534
|
+
<img
|
|
535
|
+
class="px-4 mx-auto mt-2"
|
|
536
|
+
alt="${item.overlayImage.altText}"
|
|
537
|
+
src="${baseUrl.value}${item.overlayImage.asset.sys.uri}"
|
|
538
|
+
/>
|
|
539
|
+
</div>
|
|
540
|
+
</div>`;
|
|
541
|
+
} else {
|
|
542
|
+
overlay = `
|
|
543
|
+
<div class="position-relative">
|
|
544
|
+
<div class="row g-0">
|
|
545
|
+
<img
|
|
546
|
+
class="img-fluid"
|
|
547
|
+
alt="${item.image.altText}"
|
|
548
|
+
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
549
|
+
/>
|
|
550
|
+
<div class="cec-cent-promo-txt-wrap top-50 end-0">
|
|
551
|
+
<div class="container-md">
|
|
552
|
+
<div
|
|
553
|
+
class="cec-cent-promo-txt bg-tog-for-chil-green col-lg-8 col-md-12 mx-auto my-md-4 mb-md-5 pb-2"
|
|
554
|
+
>
|
|
555
|
+
<div class="text-white text-center p-4">${item.overlayText}</div>
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
558
|
+
</div>
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
`;
|
|
562
|
+
}
|
|
563
|
+
return `
|
|
564
|
+
<div class="position-relative">
|
|
565
|
+
<div class="row g-0 mb-3">
|
|
566
|
+
<img
|
|
567
|
+
class="img-fluid"
|
|
568
|
+
alt="${item.image.altText}"
|
|
569
|
+
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
570
|
+
/>
|
|
571
|
+
${overlay}
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
`;
|
|
575
|
+
};
|
|
576
|
+
const promotionalFullWidthImageWithSideOverlay = (props: any) => {
|
|
577
|
+
let item = props.block?.value;
|
|
578
|
+
return `
|
|
579
|
+
<div class="position-relative side-overlay-section">
|
|
580
|
+
<div class="row g-0">
|
|
581
|
+
<img
|
|
582
|
+
class="img-fluid"
|
|
583
|
+
alt="${item.image.altText}"
|
|
584
|
+
src="${baseUrl.value}${item.image.asset.sys.uri}"
|
|
585
|
+
/>
|
|
586
|
+
<div
|
|
587
|
+
style="position: absolute"
|
|
588
|
+
class="my-side-overlay col-lg-6 bg-cec-green ms-lg-5 mt-lg-5 p-2 top-0"
|
|
589
|
+
>
|
|
590
|
+
<h2 class="text-white promo-heading display-6">${item.heading}</h2>
|
|
591
|
+
<div class="text-white">${item.content}</div>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
</div>
|
|
595
|
+
`;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
const processUri = (uri) => {
|
|
599
|
+
return uri.toLowerCase().replace(/%e2/g, '%E2');
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
const genericList = (props: any) => {
|
|
603
|
+
let item = props.block?.value;
|
|
604
|
+
let id = props.block.id;
|
|
605
|
+
return listItems.value[id]
|
|
606
|
+
? `
|
|
607
|
+
<h2 class="fs-4 mt-3">${item.title}</h2>
|
|
608
|
+
<ul>
|
|
609
|
+
${listItems.value[id].reduce((acc, e) => {
|
|
610
|
+
return e.sys.dataFormat === 'webpage'
|
|
611
|
+
? `${acc}
|
|
612
|
+
<li><a href="${processUri(e.sys.uri)}">${e.title}</a></li>
|
|
613
|
+
`
|
|
614
|
+
: `${acc}
|
|
615
|
+
<li>
|
|
616
|
+
<a href="${processUri(e.sys.uri)}"
|
|
617
|
+
>${e.title[0].toUpperCase()}${e.title.slice(1)}
|
|
618
|
+
(${e.sys.contentTypeId.toUpperCase()},
|
|
619
|
+
${sizeString(e.sys.properties.fileSize)})
|
|
620
|
+
</a>
|
|
621
|
+
</li>
|
|
622
|
+
`;
|
|
623
|
+
}, '')}
|
|
624
|
+
</ul>
|
|
625
|
+
`
|
|
626
|
+
: '';
|
|
627
|
+
};
|
|
628
|
+
|
|
475
629
|
const myInlineEntry = (props: any) => {
|
|
476
630
|
let data = props.block?.value;
|
|
477
631
|
let id = props.block?.id;
|
|
@@ -482,6 +636,8 @@ const myInlineEntry = (props: any) => {
|
|
|
482
636
|
return anchor(data);
|
|
483
637
|
case 'carousel':
|
|
484
638
|
return carousel(data, id);
|
|
639
|
+
case 'contactDetails':
|
|
640
|
+
return contactDetails(data);
|
|
485
641
|
case 'container':
|
|
486
642
|
return container(data);
|
|
487
643
|
case 'linkEntry':
|
|
@@ -495,56 +651,6 @@ const myInlineEntry = (props: any) => {
|
|
|
495
651
|
}
|
|
496
652
|
};
|
|
497
653
|
|
|
498
|
-
const makeQuestions = (data, id) => {
|
|
499
|
-
data.question.forEach((qu, j) => {
|
|
500
|
-
qu.stack = [0];
|
|
501
|
-
qu.buttons = qu.responseForQuestionComponent.reduce((acc, r, i) => {
|
|
502
|
-
return (
|
|
503
|
-
acc +
|
|
504
|
-
`<div class="col w-auto ps-0 pe-3">
|
|
505
|
-
<button
|
|
506
|
-
type="button"
|
|
507
|
-
id="${id}_${j}_${i}"
|
|
508
|
-
class="cec-button question-btns"
|
|
509
|
-
>
|
|
510
|
-
${r.buttonText}
|
|
511
|
-
</button>
|
|
512
|
-
</div>`
|
|
513
|
-
);
|
|
514
|
-
}, '');
|
|
515
|
-
questions.value.push({ id: id, question: data.question, stack: [0] });
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
let buttons = data.question[0].buttons;
|
|
519
|
-
return `
|
|
520
|
-
<div class="mt-3 questions">
|
|
521
|
-
<h2>Answer the questions:</h2>
|
|
522
|
-
<fieldset class="p-1 mb-3">
|
|
523
|
-
<legend>${data.entryTitle}</legend>
|
|
524
|
-
<div class="ps-2 align-items-end question row g-0">
|
|
525
|
-
<div id="${id}_display">${data.question[0].question}</div>
|
|
526
|
-
<div class="row row-cols-auto btns-div" id="${id}_buttons">
|
|
527
|
-
${buttons}
|
|
528
|
-
</div>
|
|
529
|
-
</div>
|
|
530
|
-
<button
|
|
531
|
-
type="button"
|
|
532
|
-
class="mt-4 btn btn-light previous"
|
|
533
|
-
id="${id}_prev"
|
|
534
|
-
>
|
|
535
|
-
Previous question
|
|
536
|
-
</button>
|
|
537
|
-
<button
|
|
538
|
-
type="button"
|
|
539
|
-
class="mt-4 btn btn-light reset"
|
|
540
|
-
id="${id}_reset"
|
|
541
|
-
>
|
|
542
|
-
Restart
|
|
543
|
-
</button>
|
|
544
|
-
</fieldset>
|
|
545
|
-
</div>`;
|
|
546
|
-
};
|
|
547
|
-
|
|
548
654
|
const renderer = createRenderer({
|
|
549
655
|
blocks: {
|
|
550
656
|
_inlineEntry: myInlineEntry,
|
|
@@ -553,6 +659,8 @@ const renderer = createRenderer({
|
|
|
553
659
|
accordionComponent: accordionComponent,
|
|
554
660
|
cecButton: cecButton,
|
|
555
661
|
centralColumn: centralColumn,
|
|
662
|
+
fullWidthImageWithOverlay: fullWidthImageWithOverlay,
|
|
663
|
+
fullWidthImageWithSideOverlay: fullWidthImageWithSideOverlay,
|
|
556
664
|
centralPromotionalSection: centralPromotionalSection,
|
|
557
665
|
promotionalFullWidthImageWithOverlay: promotionalFullWidthImageWithOverlay,
|
|
558
666
|
promotionalFullWidthImageWithSideOverlay:
|
package/package.json
CHANGED