@comicrelief/component-library 7.20.0 → 7.22.0
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/cypress/{integration/components/atoms/button.spec.js → e2e/components/atoms/button.cy.js} +4 -15
- package/cypress/{integration/components/atoms/buttonWithStates.spec.js → e2e/components/atoms/buttonWithStates.cy.js} +5 -11
- package/cypress/{integration/components/atoms/checkbox.spec.js → e2e/components/atoms/checkbox.cy.js} +2 -0
- package/cypress/{integration/components/atoms/confetti.spec.js → e2e/components/atoms/confetti.cy.js} +2 -8
- package/cypress/{integration/components/atoms/errorText.spec.js → e2e/components/atoms/errorText.cy.js} +1 -7
- package/cypress/{integration/components/atoms/input.spec.js → e2e/components/atoms/input.cy.js} +4 -14
- package/cypress/{integration/components/atoms/label.spec.js → e2e/components/atoms/label.cy.js} +3 -14
- package/cypress/{integration/components/atoms/link.spec.js → e2e/components/atoms/link.cy.js} +4 -21
- package/cypress/{integration/components/atoms/logo.spec.js → e2e/components/atoms/logo.cy.js} +4 -21
- package/cypress/{integration/components/atoms/pagination.spec.js → e2e/components/atoms/pagination.cy.js} +5 -28
- package/cypress/{integration/components/atoms/picture.spec.js → e2e/components/atoms/picture.cy.js} +4 -21
- package/cypress/{integration/components/atoms/radioButton.spec.js → e2e/components/atoms/radioButton.cy.js} +2 -7
- package/cypress/{integration/components/atoms/richText.spec.js → e2e/components/atoms/richText.cy.js} +2 -7
- package/cypress/{integration/components/atoms/select.spec.js → e2e/components/atoms/select.cy.js} +2 -7
- package/cypress/{integration/components/atoms/socialIcons.spec.js → e2e/components/atoms/socialIcons.cy.js} +4 -21
- package/cypress/{integration/components/atoms/text.spec.js → e2e/components/atoms/text.cy.js} +3 -14
- package/cypress/{integration/components/atoms/textArea.spec.js → e2e/components/atoms/textArea.cy.js} +2 -4
- package/cypress/{integration/components/atoms/textInputWithDrop.spec.js → e2e/components/atoms/textInputWithDrop.cy.js} +2 -4
- package/cypress/{integration/components/molecules/accordion.spec.js → e2e/components/molecules/accordion.cy.js} +2 -7
- package/cypress/{integration/components/molecules/articleTeaser.spec.js → e2e/components/molecules/articleTeaser.cy.js} +2 -7
- package/cypress/{integration/components/molecules/banner.spec.js → e2e/components/molecules/banner.cy.js} +2 -7
- package/cypress/{integration/components/molecules/box.spec.js → e2e/components/molecules/box.cy.js} +3 -11
- package/cypress/{integration/components/molecules/card.spec.js → e2e/components/molecules/card.cy.js} +3 -11
- package/cypress/{integration/components/molecules/cardDs.spec.js → e2e/components/molecules/cardDs.cy.js} +5 -30
- package/cypress/{integration/components/molecules/chip.spec.js → e2e/components/molecules/chip.cy.js} +2 -4
- package/cypress/{integration/components/molecules/countdown.spec.js → e2e/components/molecules/countdown.cy.js} +2 -4
- package/cypress/{integration/components/molecules/descriptor.spec.js → e2e/components/molecules/descriptor.cy.js} +3 -8
- package/cypress/{integration/components/molecules/doubleCopy.spec.js → e2e/components/molecules/doubleCopy.cy.js} +2 -4
- package/cypress/{integration/components/molecules/heroBanner.spec.js → e2e/components/molecules/heroBanner.cy.js} +2 -4
- package/cypress/{integration/components/molecules/infoBanner.spec.js → e2e/components/molecules/infoBanner.cy.js} +2 -4
- package/cypress/{integration/components/molecules/partnerLink.spec.js → e2e/components/molecules/partnerLink.cy.js} +2 -4
- package/cypress/{integration/components/molecules/promo.spec.js → e2e/components/molecules/promo.cy.js} +2 -4
- package/cypress/{integration/components/molecules/schoolLookup.spec.js → e2e/components/molecules/schoolLookup.cy.js} +3 -4
- package/cypress/{integration/components/molecules/searchInput.spec.js → e2e/components/molecules/searchInput.cy.js} +2 -4
- package/cypress/{integration/components/molecules/searchResult.spec.js → e2e/components/molecules/searchResult.cy.js} +5 -16
- package/cypress/{integration/components/molecules/shareButton.spec.js → e2e/components/molecules/shareButton.cy.js} +2 -4
- package/cypress/{integration/components/molecules/simpleSchoolLookup.spec.js → e2e/components/molecules/simpleSchoolLookup.cy.js} +3 -4
- package/cypress/{integration/components/molecules/singleMessage.spec.js → e2e/components/molecules/singleMessage.cy.js} +14 -49
- package/cypress/{integration/components/molecules/singleMessageDs.spec.js → e2e/components/molecules/singleMessageDs.cy.js} +6 -20
- package/cypress/{integration/components/molecules/typeahead.spec.js → e2e/components/molecules/typeahead.cy.js} +3 -4
- package/cypress/{integration/components/molecules/videoBanner.spec.js → e2e/components/molecules/videoBanner.cy.js} +4 -12
- package/cypress/{integration/components/organisms/cookieBanner.spec.js → e2e/components/organisms/cookieBanner.cy.js} +2 -4
- package/cypress/{integration/components/organisms/donate.spec.js → e2e/components/organisms/donate.cy.js} +5 -16
- package/cypress/{integration/components/organisms/emailSignUp.spec.js → e2e/components/organisms/emailSignUp.cy.js} +1 -4
- package/cypress/{integration/components/organisms/footer.spec.js → e2e/components/organisms/footer.cy.js} +2 -0
- package/cypress/{integration/components/organisms/header.spec.js → e2e/components/organisms/header.cy.js} +3 -8
- package/cypress/{integration/components/organisms/marketingPreferencesDSForm.spec.js → e2e/components/organisms/marketingPreferencesDSForm.cy.js} +44 -56
- package/cypress/{integration/components/organisms/membership.spec.js → e2e/components/organisms/membership.cy.js} +3 -8
- package/cypress.config.js +15 -0
- package/dist/components/Atoms/Link/Link.js +5 -5
- package/dist/components/Molecules/Promo/Promo.js +87 -12
- package/dist/components/Molecules/Promo/Promo.md +266 -4
- package/dist/components/Molecules/Promo/Promo.style.js +24 -6
- package/dist/components/Molecules/Promo/Promo.test.js +2 -2
- package/dist/components/Molecules/Promo/_ProgressRing.js +57 -0
- package/dist/components/Molecules/Promo/_PromoVideo.js +116 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +31 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +110 -0
- package/dist/components/Molecules/Promo/assets/Pause--black.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Pause--white.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Play--black.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Play--white.svg +3 -0
- package/dist/components/Organisms/Footer/Footer.js +1 -1
- package/dist/components/Organisms/Footer/Footer.md +2 -2
- package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +2 -2
- package/dist/components/Organisms/Footer/data/data.js +2 -2
- package/dist/components/Organisms/Header/Nav/Nav.js +2 -2
- package/dist/components/Organisms/Header/data/data.js +2 -2
- package/dist/index.js +3 -3
- package/dist/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/dist/utils/{whiteListed.js → allowListed.js} +4 -4
- package/dist/utils/allowListed.test.js +12 -0
- package/docs/utils.md +4 -4
- package/package.json +2 -2
- package/src/components/Atoms/Link/Link.js +5 -5
- package/src/components/Molecules/Promo/Promo.js +89 -13
- package/src/components/Molecules/Promo/Promo.md +266 -4
- package/src/components/Molecules/Promo/Promo.style.js +23 -2
- package/src/components/Molecules/Promo/Promo.test.js +2 -2
- package/src/components/Molecules/Promo/_ProgressRing.js +43 -0
- package/src/components/Molecules/Promo/_PromoVideo.js +105 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.js +26 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.style.js +121 -0
- package/src/components/Molecules/Promo/assets/Pause--black.svg +3 -0
- package/src/components/Molecules/Promo/assets/Pause--white.svg +3 -0
- package/src/components/Molecules/Promo/assets/Play--black.svg +3 -0
- package/src/components/Molecules/Promo/assets/Play--white.svg +3 -0
- package/src/components/Organisms/Footer/Footer.js +2 -2
- package/src/components/Organisms/Footer/Footer.md +2 -2
- package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +2 -2
- package/src/components/Organisms/Footer/data/data.js +2 -2
- package/src/components/Organisms/Header/Nav/Nav.js +2 -2
- package/src/components/Organisms/Header/data/data.js +2 -2
- package/src/index.js +1 -1
- package/src/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/src/utils/{whiteListed.js → allowListed.js} +6 -5
- package/src/utils/allowListed.test.js +9 -0
- package/cypress.json +0 -6
- package/dist/utils/whiteListed.test.js +0 -12
- package/src/utils/whiteListed.test.js +0 -9
- /package/cypress/support/{index.js → e2e.js} +0 -0
|
@@ -14,7 +14,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
14
14
|
image={defaultData.promoImage}
|
|
15
15
|
imageLow={defaultData.promoImage}
|
|
16
16
|
imageAltText=""
|
|
17
|
-
|
|
17
|
+
copyLeft={true}
|
|
18
18
|
hasOverlay={true}
|
|
19
19
|
position="upper"
|
|
20
20
|
>
|
|
@@ -50,7 +50,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
50
50
|
image={defaultData.promoImage}
|
|
51
51
|
imageLow={defaultData.promoImage}
|
|
52
52
|
imageAltText=""
|
|
53
|
-
|
|
53
|
+
copyLeft={true}
|
|
54
54
|
hasOverlay={true}
|
|
55
55
|
position="end"
|
|
56
56
|
>
|
|
@@ -86,7 +86,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
86
86
|
image={defaultData.promoImage}
|
|
87
87
|
imageLow={defaultData.promoImage}
|
|
88
88
|
imageAltText=""
|
|
89
|
-
|
|
89
|
+
copyLeft={true}
|
|
90
90
|
hasOverlay={true}
|
|
91
91
|
position="lower"
|
|
92
92
|
>
|
|
@@ -122,7 +122,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
122
122
|
image={defaultData.promoImage}
|
|
123
123
|
imageLow={defaultData.promoImage}
|
|
124
124
|
imageAltText=""
|
|
125
|
-
|
|
125
|
+
copyLeft={true}
|
|
126
126
|
hasOverlay={true}
|
|
127
127
|
>
|
|
128
128
|
<Text
|
|
@@ -149,3 +149,265 @@ import Link from '../../Atoms/Link/Link';
|
|
|
149
149
|
</Promo>
|
|
150
150
|
</div>
|
|
151
151
|
```
|
|
152
|
+
|
|
153
|
+
Promo w/Video
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
|
|
157
|
+
import Link from '../../Atoms/Link/Link';
|
|
158
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
159
|
+
import mobilePoster from '../../../styleguide/assets/mobileVideoPosterImage.png';
|
|
160
|
+
const videoSrc =
|
|
161
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
162
|
+
|
|
163
|
+
let mobileVideoSrc = 'https://samplelib.com/lib/preview/mp4/sample-10s.mp4';
|
|
164
|
+
|
|
165
|
+
<div>
|
|
166
|
+
<Text tag="h2" size="xl" color="black">
|
|
167
|
+
Promo Upper w/Video (autoplay and loop)
|
|
168
|
+
</Text>
|
|
169
|
+
<Promo
|
|
170
|
+
backgroundColor="blue_dark"
|
|
171
|
+
imageSet={defaultData.promoImage}
|
|
172
|
+
image={defaultData.promoImage}
|
|
173
|
+
imageLow={defaultData.promoImage}
|
|
174
|
+
imageAltText=""
|
|
175
|
+
copyLeft={true}
|
|
176
|
+
hasOverlay={true}
|
|
177
|
+
position="upper"
|
|
178
|
+
videoSrc={videoSrc}
|
|
179
|
+
poster={poster}
|
|
180
|
+
loop={true}
|
|
181
|
+
autoplay={true}
|
|
182
|
+
>
|
|
183
|
+
<Text
|
|
184
|
+
tag="h1"
|
|
185
|
+
color="white"
|
|
186
|
+
size="super"
|
|
187
|
+
family="Anton"
|
|
188
|
+
uppercase
|
|
189
|
+
weight="normal"
|
|
190
|
+
>
|
|
191
|
+
Curabitur pretium tincidunt lacus
|
|
192
|
+
</Text>
|
|
193
|
+
<Text tag="p" color="white">
|
|
194
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
195
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
196
|
+
</Text>
|
|
197
|
+
<span>
|
|
198
|
+
<Link href="/" type="button" color="white">
|
|
199
|
+
<Text>
|
|
200
|
+
Show me this
|
|
201
|
+
</Text>
|
|
202
|
+
</Link>
|
|
203
|
+
</span>
|
|
204
|
+
</Promo>
|
|
205
|
+
|
|
206
|
+
<br />
|
|
207
|
+
|
|
208
|
+
<Text tag="h2" size="xl" color="black">
|
|
209
|
+
Promo End w/Video (loop only)
|
|
210
|
+
</Text>
|
|
211
|
+
<Promo
|
|
212
|
+
backgroundColor="blue_dark"
|
|
213
|
+
imageSet={defaultData.promoImage}
|
|
214
|
+
image={defaultData.promoImage}
|
|
215
|
+
imageLow={defaultData.promoImage}
|
|
216
|
+
imageAltText=""
|
|
217
|
+
copyLeft={true}
|
|
218
|
+
hasOverlay={true}
|
|
219
|
+
position="end"
|
|
220
|
+
videoSrc={videoSrc}
|
|
221
|
+
poster={poster}
|
|
222
|
+
loop={true}
|
|
223
|
+
autoPlay={false}
|
|
224
|
+
>
|
|
225
|
+
<Text
|
|
226
|
+
tag="h1"
|
|
227
|
+
color="white"
|
|
228
|
+
size="super"
|
|
229
|
+
family="Anton"
|
|
230
|
+
uppercase
|
|
231
|
+
weight="normal"
|
|
232
|
+
>
|
|
233
|
+
Curabitur pretium tincidunt lacus
|
|
234
|
+
</Text>
|
|
235
|
+
<Text tag="p" color="white">
|
|
236
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
237
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
238
|
+
</Text>
|
|
239
|
+
<span>
|
|
240
|
+
<Link href="/" type="button" color="white">
|
|
241
|
+
<Text>
|
|
242
|
+
Show me this
|
|
243
|
+
</Text>
|
|
244
|
+
</Link>
|
|
245
|
+
</span>
|
|
246
|
+
</Promo>
|
|
247
|
+
|
|
248
|
+
<br />
|
|
249
|
+
|
|
250
|
+
<Text tag="h2" size="xl" color="black">
|
|
251
|
+
Promo Lower w/Video (autoplay only)
|
|
252
|
+
</Text>
|
|
253
|
+
<Promo
|
|
254
|
+
backgroundColor="blue_dark"
|
|
255
|
+
imageSet={defaultData.promoImage}
|
|
256
|
+
image={defaultData.promoImage}
|
|
257
|
+
imageLow={defaultData.promoImage}
|
|
258
|
+
imageAltText=""
|
|
259
|
+
copyLeft={true}
|
|
260
|
+
hasOverlay={true}
|
|
261
|
+
position="lower"
|
|
262
|
+
videoSrc={videoSrc}
|
|
263
|
+
poster={poster}
|
|
264
|
+
loop={false}
|
|
265
|
+
autoPlay={true}
|
|
266
|
+
>
|
|
267
|
+
<Text
|
|
268
|
+
tag="h1"
|
|
269
|
+
color="white"
|
|
270
|
+
size="super"
|
|
271
|
+
family="Anton"
|
|
272
|
+
uppercase
|
|
273
|
+
weight="normal"
|
|
274
|
+
>
|
|
275
|
+
Curabitur pretium tincidunt lacus
|
|
276
|
+
</Text>
|
|
277
|
+
<Text tag="p" color="white">
|
|
278
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
279
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
280
|
+
</Text>
|
|
281
|
+
<span>
|
|
282
|
+
<Link href="/" type="button" color="white">
|
|
283
|
+
<Text>
|
|
284
|
+
Show me this
|
|
285
|
+
</Text>
|
|
286
|
+
</Link>
|
|
287
|
+
</span>
|
|
288
|
+
</Promo>
|
|
289
|
+
|
|
290
|
+
<br />
|
|
291
|
+
<Text tag="h2" size="xl" color="black">
|
|
292
|
+
Promo None w/Video (no loop or autoplay)
|
|
293
|
+
</Text>
|
|
294
|
+
<Promo
|
|
295
|
+
backgroundColor="blue_dark"
|
|
296
|
+
imageSet={defaultData.promoImage}
|
|
297
|
+
image={defaultData.promoImage}
|
|
298
|
+
imageLow={defaultData.promoImage}
|
|
299
|
+
imageAltText=""
|
|
300
|
+
copyLeft={false}
|
|
301
|
+
hasOverlay={true}
|
|
302
|
+
videoSrc={videoSrc}
|
|
303
|
+
poster={poster}
|
|
304
|
+
loop={false}
|
|
305
|
+
autoPlay={false}
|
|
306
|
+
>
|
|
307
|
+
<Text
|
|
308
|
+
tag="h1"
|
|
309
|
+
color="white"
|
|
310
|
+
size="super"
|
|
311
|
+
family="Anton"
|
|
312
|
+
uppercase
|
|
313
|
+
weight="normal"
|
|
314
|
+
>
|
|
315
|
+
Curabitur pretium tincidunt lacus
|
|
316
|
+
</Text>
|
|
317
|
+
<Text tag="p" color="white">
|
|
318
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
319
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
320
|
+
</Text>
|
|
321
|
+
<span>
|
|
322
|
+
<Link href="/" type="button" color="white">
|
|
323
|
+
<Text>
|
|
324
|
+
Show me this
|
|
325
|
+
</Text>
|
|
326
|
+
</Link>
|
|
327
|
+
</span>
|
|
328
|
+
</Promo>
|
|
329
|
+
|
|
330
|
+
<Text tag="h2" size="xl" color="black">
|
|
331
|
+
Promo None w/Video (no loop or autoplay, 'light-coloured video' setting, different videos and posters for mobile and desktop)
|
|
332
|
+
</Text>
|
|
333
|
+
<Promo
|
|
334
|
+
backgroundColor="blue_light"
|
|
335
|
+
imageSet={defaultData.promoImage}
|
|
336
|
+
image={defaultData.promoImage}
|
|
337
|
+
imageLow={defaultData.promoImage}
|
|
338
|
+
imageAltText=""
|
|
339
|
+
copyLeft={true}
|
|
340
|
+
hasOverlay={true}
|
|
341
|
+
videoSrc={videoSrc}
|
|
342
|
+
mobileVideoSrc={mobileVideoSrc}
|
|
343
|
+
poster={poster}
|
|
344
|
+
mobilePoster={mobilePoster}
|
|
345
|
+
loop={false}
|
|
346
|
+
autoPlay={false}
|
|
347
|
+
lightColouredVideo={true}
|
|
348
|
+
>
|
|
349
|
+
<Text
|
|
350
|
+
tag="h1"
|
|
351
|
+
color="black"
|
|
352
|
+
size="super"
|
|
353
|
+
family="Anton"
|
|
354
|
+
uppercase
|
|
355
|
+
weight="normal"
|
|
356
|
+
>
|
|
357
|
+
Curabitur pretium tincidunt lacus
|
|
358
|
+
</Text>
|
|
359
|
+
<Text tag="p" color="black">
|
|
360
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
361
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
362
|
+
</Text>
|
|
363
|
+
<span>
|
|
364
|
+
<Link href="/" type="button" color="black">
|
|
365
|
+
<Text>
|
|
366
|
+
Show me this
|
|
367
|
+
</Text>
|
|
368
|
+
</Link>
|
|
369
|
+
</span>
|
|
370
|
+
</Promo>
|
|
371
|
+
|
|
372
|
+
<Text tag="h2" size="xl" color="black">
|
|
373
|
+
Promo None w/Video (no loop or autoplay, 'light-coloured video' setting, mobile-only video and poster)
|
|
374
|
+
</Text>
|
|
375
|
+
<Promo
|
|
376
|
+
backgroundColor="blue_light"
|
|
377
|
+
imageSet={defaultData.promoImage}
|
|
378
|
+
image={defaultData.promoImage}
|
|
379
|
+
imageLow={defaultData.promoImage}
|
|
380
|
+
imageAltText=""
|
|
381
|
+
copyLeft={true}
|
|
382
|
+
hasOverlay={true}
|
|
383
|
+
mobileVideoSrc={mobileVideoSrc}
|
|
384
|
+
mobilePoster={mobilePoster}
|
|
385
|
+
loop={false}
|
|
386
|
+
autoPlay={false}
|
|
387
|
+
lightColouredVideo={true}
|
|
388
|
+
>
|
|
389
|
+
<Text
|
|
390
|
+
tag="h1"
|
|
391
|
+
color="black"
|
|
392
|
+
size="super"
|
|
393
|
+
family="Anton"
|
|
394
|
+
uppercase
|
|
395
|
+
weight="normal"
|
|
396
|
+
>
|
|
397
|
+
Curabitur pretium tincidunt lacus
|
|
398
|
+
</Text>
|
|
399
|
+
<Text tag="p" color="black">
|
|
400
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
401
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
402
|
+
</Text>
|
|
403
|
+
<span>
|
|
404
|
+
<Link href="/" type="button" color="black">
|
|
405
|
+
<Text>
|
|
406
|
+
Show me this
|
|
407
|
+
</Text>
|
|
408
|
+
</Link>
|
|
409
|
+
</span>
|
|
410
|
+
</Promo>
|
|
411
|
+
|
|
412
|
+
</div>
|
|
413
|
+
```
|
|
@@ -44,7 +44,8 @@ const Wrapper = styled.div`
|
|
|
44
44
|
margin: 0 auto;
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
${({ copyLeft }) => !copyLeft && 'justify-content: flex-end'};
|
|
48
49
|
${media('medium')} {
|
|
49
50
|
min-height: calc(100vh - 90px);
|
|
50
51
|
}
|
|
@@ -54,6 +55,7 @@ const Copy = styled.div`
|
|
|
54
55
|
width: 100%;
|
|
55
56
|
padding: ${spacing('m')} ${spacing('m')} ${spacing('xl')};
|
|
56
57
|
${zIndex('low')};
|
|
58
|
+
|
|
57
59
|
${media('medium')} {
|
|
58
60
|
width: 70%;
|
|
59
61
|
padding: ${spacing('xl')} ${spacing('m')};
|
|
@@ -61,7 +63,18 @@ const Copy = styled.div`
|
|
|
61
63
|
${media('medium')} {
|
|
62
64
|
width: 50%;
|
|
63
65
|
padding: ${spacing('xxl')} ${spacing('m')};
|
|
66
|
+
|
|
67
|
+
${({ hasVideo }) => hasVideo !== false && css`
|
|
68
|
+
background-color: rgba(0,0,0,0.75);
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
box-shadow: 0px 0px 75px 100px rgba(0, 0, 0, 0.75);
|
|
71
|
+
`}
|
|
72
|
+
${({ hasVideo, lightColouredVideo }) => (hasVideo !== false && lightColouredVideo) && css`
|
|
73
|
+
background-color: rgba(255, 255, 255, 0.75);
|
|
74
|
+
box-shadow: 0px 0px 75px 100px rgba(255, 255, 255, 0.75);
|
|
75
|
+
`}
|
|
64
76
|
}
|
|
77
|
+
|
|
65
78
|
${({ position }) => position === 'lower' && css`
|
|
66
79
|
padding: ${spacing('xl')} ${spacing('m')};
|
|
67
80
|
${media('medium')} {
|
|
@@ -83,6 +96,14 @@ const Media = styled.div`
|
|
|
83
96
|
}
|
|
84
97
|
`;
|
|
85
98
|
|
|
99
|
+
const Video = styled.video.attrs(() => ({
|
|
100
|
+
playsInline: true
|
|
101
|
+
}))`
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
object-fit: cover;
|
|
105
|
+
`;
|
|
106
|
+
|
|
86
107
|
export {
|
|
87
|
-
Container, Wrapper, Copy, Media
|
|
108
|
+
Container, Wrapper, Copy, Media, Video
|
|
88
109
|
};
|
|
@@ -13,7 +13,7 @@ it('renders Promo correctly', () => {
|
|
|
13
13
|
imageSet={defaultData.promoImage}
|
|
14
14
|
image={defaultData.promoImage}
|
|
15
15
|
imageAltText=""
|
|
16
|
-
|
|
16
|
+
copyLeft={false}
|
|
17
17
|
>
|
|
18
18
|
<Text
|
|
19
19
|
tag="h1"
|
|
@@ -47,7 +47,7 @@ it('renders Promo correctly end position', () => {
|
|
|
47
47
|
imageSet={defaultData.promoImage}
|
|
48
48
|
image={defaultData.promoImage}
|
|
49
49
|
imageAltText=""
|
|
50
|
-
|
|
50
|
+
copyLeft={false}
|
|
51
51
|
position="end"
|
|
52
52
|
>
|
|
53
53
|
<Text
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ProgressRingWrapper, ProgressRingSVG, ProgressRingCircle
|
|
6
|
+
} from './_PromoVideoButton.style';
|
|
7
|
+
|
|
8
|
+
const ProgressRing = ({
|
|
9
|
+
videoProgress, ...rest
|
|
10
|
+
}) => {
|
|
11
|
+
const thisStroke = 4;
|
|
12
|
+
const thisRadius = 28;
|
|
13
|
+
const initNormRadius = thisRadius - thisStroke * 2;
|
|
14
|
+
const thisCircumference = initNormRadius * 2 * Math.PI;
|
|
15
|
+
const [thisDashOffset, setThisDashOffset] = useState(initNormRadius * 2 * Math.PI);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const offset = thisCircumference - ((videoProgress / 100) * thisCircumference);
|
|
19
|
+
setThisDashOffset(offset);
|
|
20
|
+
}, [videoProgress, thisCircumference]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<ProgressRingWrapper videoProgress={videoProgress}>
|
|
24
|
+
<ProgressRingSVG height={thisRadius * 2} width={thisRadius * 2}>
|
|
25
|
+
<ProgressRingCircle
|
|
26
|
+
strokeDasharray={`${thisCircumference} ${thisCircumference}`}
|
|
27
|
+
strokeDashOffsetStyle={thisDashOffset}
|
|
28
|
+
strokeWidth={`${thisStroke}`}
|
|
29
|
+
r={`${initNormRadius}`}
|
|
30
|
+
cx={`${thisRadius}`}
|
|
31
|
+
cy={`${thisRadius}`}
|
|
32
|
+
{...rest}
|
|
33
|
+
/>
|
|
34
|
+
</ProgressRingSVG>
|
|
35
|
+
</ProgressRingWrapper>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
ProgressRing.propTypes = {
|
|
40
|
+
videoProgress: PropTypes.number.isRequired
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default ProgressRing;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Video } from './Promo.style';
|
|
4
|
+
import PromoVideoButton from './_PromoVideoButton';
|
|
5
|
+
|
|
6
|
+
const PromoVideo = ({
|
|
7
|
+
lightColouredVideo,
|
|
8
|
+
copyLeft,
|
|
9
|
+
thisVideoSrc,
|
|
10
|
+
thisPoster,
|
|
11
|
+
autoPlay,
|
|
12
|
+
loop,
|
|
13
|
+
showPosterAfterPlaying
|
|
14
|
+
}) => {
|
|
15
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
16
|
+
const [isRestarting, setIsRestarting] = useState(false);
|
|
17
|
+
const [videoProgress, setVideoProgress] = useState(0);
|
|
18
|
+
const videoEl = useRef(null);
|
|
19
|
+
|
|
20
|
+
const togglePlay = () => {
|
|
21
|
+
if (isPlaying) videoEl.current.pause();
|
|
22
|
+
else videoEl.current.play();
|
|
23
|
+
setIsPlaying(!isPlaying);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const updateTime = () => {
|
|
27
|
+
if (videoEl.current.duration) {
|
|
28
|
+
// Calculate the percentage of the video played:
|
|
29
|
+
const percentage = Math.round((videoEl.current.currentTime / videoEl.current.duration) * 100);
|
|
30
|
+
// Because a completely smooth animation is impossible with the 250ms-ish frequency of
|
|
31
|
+
// the 'timeupdate' event, we're electing to just update the ring every 25%.
|
|
32
|
+
const nearest = 25;
|
|
33
|
+
const roundedPercentage = (percentage + nearest / 2) - ((percentage + nearest / 2) % nearest);
|
|
34
|
+
setVideoProgress(roundedPercentage);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Only loads once the initial screensize check is complete
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
// Use truthy comparison so either a null OR undefined value won't work
|
|
41
|
+
if (thisVideoSrc != null) {
|
|
42
|
+
videoEl.current.addEventListener('timeupdate', updateTime);
|
|
43
|
+
// Trigger on-load autoplay if apppropriate
|
|
44
|
+
if (autoPlay && !isPlaying) {
|
|
45
|
+
togglePlay();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
videoEl.current.addEventListener('ended', () => {
|
|
49
|
+
// Used purely to halt the CSS animation:
|
|
50
|
+
setIsRestarting(true);
|
|
51
|
+
|
|
52
|
+
// If this is a non-looping video, add a listener to update our local state
|
|
53
|
+
// once the video's ended, to let the user retrigger it manually:
|
|
54
|
+
if (!loop) {
|
|
55
|
+
setIsPlaying(false);
|
|
56
|
+
setVideoProgress(0);
|
|
57
|
+
// Reload the video to show the poster image:
|
|
58
|
+
if (showPosterAfterPlaying) videoEl.current.load();
|
|
59
|
+
} else {
|
|
60
|
+
// Rather than using the Video 'loop' property, we retrigger
|
|
61
|
+
// it in *code* as there's no 'restarted' to hook into:
|
|
62
|
+
togglePlay();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Grace period to allow the animation to reset
|
|
66
|
+
setTimeout(() => { setIsRestarting(false); }, 100);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// CERTAINLY don't want this re-running for EACH of these variable updates, sorry Lint...
|
|
70
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
+
}, [thisVideoSrc]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<Video
|
|
76
|
+
ref={videoEl}
|
|
77
|
+
src={thisVideoSrc}
|
|
78
|
+
poster={thisPoster}
|
|
79
|
+
muted
|
|
80
|
+
>
|
|
81
|
+
Your browser does not support this video filetype.
|
|
82
|
+
</Video>
|
|
83
|
+
<PromoVideoButton
|
|
84
|
+
copyLeft={copyLeft}
|
|
85
|
+
videoProgress={videoProgress}
|
|
86
|
+
togglePlay={togglePlay}
|
|
87
|
+
isPlaying={isPlaying}
|
|
88
|
+
lightColouredVideo={lightColouredVideo}
|
|
89
|
+
isRestarting={isRestarting}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
PromoVideo.propTypes = {
|
|
96
|
+
copyLeft: PropTypes.bool.isRequired,
|
|
97
|
+
lightColouredVideo: PropTypes.bool.isRequired,
|
|
98
|
+
thisVideoSrc: PropTypes.string.isRequired,
|
|
99
|
+
thisPoster: PropTypes.string.isRequired,
|
|
100
|
+
autoPlay: PropTypes.bool.isRequired,
|
|
101
|
+
loop: PropTypes.bool.isRequired,
|
|
102
|
+
showPosterAfterPlaying: PropTypes.bool.isRequired
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default PromoVideo;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ProgressRing from './_ProgressRing';
|
|
4
|
+
import { PlayButtonWrapper, PlayButton, Icon } from './_PromoVideoButton.style';
|
|
5
|
+
|
|
6
|
+
const PromoVideoButton = ({
|
|
7
|
+
togglePlay, ...rest
|
|
8
|
+
}) => (
|
|
9
|
+
<PlayButtonWrapper>
|
|
10
|
+
<PlayButton
|
|
11
|
+
onClick={() => { togglePlay(); }}
|
|
12
|
+
{...rest}
|
|
13
|
+
>
|
|
14
|
+
<Icon {...rest} />
|
|
15
|
+
<ProgressRing
|
|
16
|
+
{...rest}
|
|
17
|
+
/>
|
|
18
|
+
</PlayButton>
|
|
19
|
+
</PlayButtonWrapper>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
PromoVideoButton.propTypes = {
|
|
23
|
+
togglePlay: PropTypes.func.isRequired
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default PromoVideoButton;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import playWhite from './assets/Play--white.svg';
|
|
3
|
+
import pauseWhite from './assets/Pause--white.svg';
|
|
4
|
+
import playBlack from './assets/Play--black.svg';
|
|
5
|
+
import pauseBlack from './assets/Pause--black.svg';
|
|
6
|
+
|
|
7
|
+
const PlayButton = styled.button`
|
|
8
|
+
display: flex;
|
|
9
|
+
width: 50px;
|
|
10
|
+
height: 50px;
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 10px;
|
|
13
|
+
right: 10px;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
border: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
margin: 0;
|
|
19
|
+
border-radius: 50%;
|
|
20
|
+
background: ${({ theme }) => theme.color('black')};
|
|
21
|
+
opacity: 0.75;
|
|
22
|
+
transition: opacity 0.2s;
|
|
23
|
+
|
|
24
|
+
&:hover,
|
|
25
|
+
&:focus {
|
|
26
|
+
opacity: 1.0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:focus-visible {
|
|
30
|
+
outline-style: outset;
|
|
31
|
+
outline-width: medium;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Non-light coloured video:
|
|
35
|
+
${({ lightColouredVideo }) => !lightColouredVideo && css`
|
|
36
|
+
background: ${({ theme }) => theme.color('white')};
|
|
37
|
+
`}
|
|
38
|
+
|
|
39
|
+
${({ copyLeft }) => !copyLeft && css`
|
|
40
|
+
right: auto;
|
|
41
|
+
left: 10px;
|
|
42
|
+
`}
|
|
43
|
+
|
|
44
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
45
|
+
top: 20px;
|
|
46
|
+
right: 20px;
|
|
47
|
+
|
|
48
|
+
${({ copyLeft }) => !copyLeft && css`
|
|
49
|
+
right: auto;
|
|
50
|
+
left: 20px;
|
|
51
|
+
`}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const PlayButtonWrapper = styled.div`
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const ProgressRingWrapper = styled.span`
|
|
64
|
+
position: absolute;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
display: flex;
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const ProgressRingSVG = styled.svg`
|
|
71
|
+
//
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const ProgressRingCircle = styled.circle`
|
|
75
|
+
z-index: 100;
|
|
76
|
+
transition: stroke-dashoffset 0.5s;
|
|
77
|
+
|
|
78
|
+
transform: rotate(-90deg);
|
|
79
|
+
transform-origin: 50% 50%;
|
|
80
|
+
stroke-dashoffset: ${({ strokeDashOffsetStyle }) => strokeDashOffsetStyle};
|
|
81
|
+
stroke: white; // need to changed based on Promo settings
|
|
82
|
+
fill: transparent;
|
|
83
|
+
|
|
84
|
+
// Non-light coloured video, white button, black stroke
|
|
85
|
+
${({ lightColouredVideo }) => !lightColouredVideo && css`
|
|
86
|
+
stroke: ${({ theme }) => theme.color('black')};
|
|
87
|
+
`}
|
|
88
|
+
|
|
89
|
+
// Cancel the animation
|
|
90
|
+
${({ isRestarting }) => (isRestarting) && css`
|
|
91
|
+
transition: none;
|
|
92
|
+
`}
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
const Icon = styled.span`
|
|
96
|
+
height: 50px;
|
|
97
|
+
width: 50px;
|
|
98
|
+
background: no-repeat center/50% url(${playWhite}) transparent;
|
|
99
|
+
|
|
100
|
+
// Light-coloured video, black button, white icons
|
|
101
|
+
${({ lightColouredVideo, isPlaying }) => (lightColouredVideo && !isPlaying) && css`
|
|
102
|
+
background-image: url(${playWhite});
|
|
103
|
+
`}
|
|
104
|
+
|
|
105
|
+
${({ lightColouredVideo, isPlaying }) => (lightColouredVideo && isPlaying) && css`
|
|
106
|
+
background-image: url(${pauseWhite});
|
|
107
|
+
`}
|
|
108
|
+
|
|
109
|
+
// Non-light coloured video, white button, black icons
|
|
110
|
+
${({ lightColouredVideo, isPlaying }) => (!lightColouredVideo && !isPlaying) && css`
|
|
111
|
+
background-image: url(${playBlack});
|
|
112
|
+
`}
|
|
113
|
+
|
|
114
|
+
${({ lightColouredVideo, isPlaying }) => (!lightColouredVideo && isPlaying) && css`
|
|
115
|
+
background-image: url(${pauseBlack});
|
|
116
|
+
`}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
ProgressRingWrapper, ProgressRingSVG, ProgressRingCircle, PlayButton, PlayButtonWrapper, Icon
|
|
121
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C10.8954 6 10 6.89543 10 8V40C10 41.1046 10.8954 42 12 42H17C18.1046 42 19 41.1046 19 40V8C19 6.89543 18.1046 6 17 6H12ZM31 6C29.8954 6 29 6.89543 29 8V40C29 41.1046 29.8954 42 31 42H36C37.1046 42 38 41.1046 38 40V8C38 6.89543 37.1046 6 36 6H31Z" fill="#222222"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C10.8954 6 10 6.89543 10 8V40C10 41.1046 10.8954 42 12 42H17C18.1046 42 19 41.1046 19 40V8C19 6.89543 18.1046 6 17 6H12ZM31 6C29.8954 6 29 6.89543 29 8V40C29 41.1046 29.8954 42 31 42H36C37.1046 42 38 41.1046 38 40V8C38 6.89543 37.1046 6 36 6H31Z" fill="#FFFFFF"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M39.6845 22.5846L11.457 6.22056C10.9505 5.92706 10.326 5.92656 9.819 6.21856C9.3125 6.51056 9 7.05156 9 7.63656V40.3641C9 40.9491 9.3125 41.4901 9.8195 41.7821C10.0725 41.9276 10.3545 42.0001 10.6365 42.0001C10.92 42.0001 11.2035 41.9266 11.4575 41.7796L39.685 25.4161C40.189 25.1231 40.5 24.5836 40.5 24.0001C40.5 23.4166 40.189 22.8771 39.6845 22.5846Z" fill="#222222"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M39.6845 22.5846L11.457 6.22056C10.9505 5.92706 10.326 5.92656 9.819 6.21856C9.3125 6.51056 9 7.05156 9 7.63656V40.3641C9 40.9491 9.3125 41.4901 9.8195 41.7821C10.0725 41.9276 10.3545 42.0001 10.6365 42.0001C10.92 42.0001 11.2035 41.9266 11.4575 41.7796L39.685 25.4161C40.189 25.1231 40.5 24.5836 40.5 24.0001C40.5 23.4166 40.189 22.8771 39.6845 22.5846Z" fill="#FFFFFF"/>
|
|
3
|
+
</svg>
|