@comicrelief/component-library 7.21.0 → 7.22.1
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/components/Molecules/Promo/Promo.js +95 -13
- package/dist/components/Molecules/Promo/Promo.md +252 -8
- package/dist/components/Molecules/Promo/Promo.style.js +31 -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 +118 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +33 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +110 -0
- package/dist/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +116 -72
- 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/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/package.json +1 -1
- package/src/components/Molecules/Promo/Promo.js +96 -14
- package/src/components/Molecules/Promo/Promo.md +252 -8
- package/src/components/Molecules/Promo/Promo.style.js +40 -7
- 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 +108 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.js +26 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.style.js +126 -0
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +116 -72
- 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/styleguide/assets/mobileVideoPosterImage.png +0 -0
|
@@ -7,28 +7,86 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _PromoVideo = _interopRequireDefault(require("./_PromoVideo"));
|
|
15
|
+
|
|
16
|
+
var _breakpoint = require("../../../theme/shared/breakpoint");
|
|
11
17
|
|
|
12
18
|
var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
|
|
13
19
|
|
|
14
20
|
var _Promo = require("./Promo.style");
|
|
15
21
|
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
16
26
|
var Promo = function Promo(_ref) {
|
|
17
|
-
var
|
|
27
|
+
var copyLeft = _ref.copyLeft,
|
|
18
28
|
backgroundColor = _ref.backgroundColor,
|
|
19
29
|
imageLow = _ref.imageLow,
|
|
20
30
|
imageSet = _ref.imageSet,
|
|
21
31
|
image = _ref.image,
|
|
22
32
|
imageAltText = _ref.imageAltText,
|
|
23
33
|
children = _ref.children,
|
|
24
|
-
position = _ref.position
|
|
25
|
-
|
|
34
|
+
position = _ref.position,
|
|
35
|
+
autoPlay = _ref.autoPlay,
|
|
36
|
+
loop = _ref.loop,
|
|
37
|
+
poster = _ref.poster,
|
|
38
|
+
mobilePoster = _ref.mobilePoster,
|
|
39
|
+
showPosterAfterPlaying = _ref.showPosterAfterPlaying,
|
|
40
|
+
videoSrc = _ref.videoSrc,
|
|
41
|
+
mobileVideoSrc = _ref.mobileVideoSrc,
|
|
42
|
+
behindTextGradient = _ref.behindTextGradient,
|
|
43
|
+
blackPlayButton = _ref.blackPlayButton;
|
|
44
|
+
|
|
45
|
+
// Store the appropriate prop in state, dependent on the breakpoint
|
|
46
|
+
var _useState = (0, _react.useState)(null),
|
|
47
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
48
|
+
thisVideoSrc = _useState2[0],
|
|
49
|
+
setThisVideoSrc = _useState2[1];
|
|
50
|
+
|
|
51
|
+
var _useState3 = (0, _react.useState)(null),
|
|
52
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
53
|
+
thisPoster = _useState4[0],
|
|
54
|
+
setThisPoster = _useState4[1]; // Let either field define this, just in case
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var hasVideo = Boolean(videoSrc || mobileVideoSrc); // A 'video-y' Promo will override and ignore any 'non-Video' images;
|
|
58
|
+
// none of these fields are required so we have to handle them accordingly:
|
|
59
|
+
|
|
60
|
+
var hasImage = Boolean(imageSet && !hasVideo); // Runs on initial load:
|
|
61
|
+
|
|
62
|
+
(0, _react.useEffect)(function () {
|
|
63
|
+
if (hasVideo) {
|
|
64
|
+
// Checks size on load ONLY; don't want to mess about with listeners:
|
|
65
|
+
var isDesktop = window.innerWidth >= _breakpoint.sizes.nav; // 1024+ px
|
|
66
|
+
|
|
67
|
+
var currentPoster;
|
|
68
|
+
var currentSrc; // If we've got both desktop AND mobile videos, let the
|
|
69
|
+
// *current* screen width define which video src to use:
|
|
70
|
+
|
|
71
|
+
if (videoSrc && mobileVideoSrc) {
|
|
72
|
+
currentSrc = isDesktop ? videoSrc : mobileVideoSrc;
|
|
73
|
+
currentPoster = isDesktop ? poster : mobilePoster;
|
|
74
|
+
} else {
|
|
75
|
+
// Else, pick whatever we DO actually have:
|
|
76
|
+
currentSrc = videoSrc || mobileVideoSrc;
|
|
77
|
+
currentPoster = poster || mobilePoster;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
setThisVideoSrc(currentSrc);
|
|
81
|
+
setThisPoster(currentPoster);
|
|
82
|
+
}
|
|
83
|
+
}, [hasVideo, videoSrc, mobileVideoSrc, mobilePoster, poster]);
|
|
26
84
|
return /*#__PURE__*/_react.default.createElement(_Promo.Container, {
|
|
27
85
|
backgroundColor: backgroundColor,
|
|
28
86
|
position: position
|
|
29
|
-
},
|
|
30
|
-
imageRight:
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement(_Promo.Media, {
|
|
88
|
+
imageRight: copyLeft
|
|
89
|
+
}, hasImage && !hasVideo && /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
32
90
|
alt: imageAltText,
|
|
33
91
|
imageLow: imageLow,
|
|
34
92
|
images: imageSet,
|
|
@@ -36,22 +94,46 @@ var Promo = function Promo(_ref) {
|
|
|
36
94
|
objectFit: "cover",
|
|
37
95
|
width: "100%",
|
|
38
96
|
height: "100%"
|
|
39
|
-
})
|
|
40
|
-
|
|
97
|
+
}), hasVideo && thisVideoSrc && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_PromoVideo.default, {
|
|
98
|
+
copyLeft: copyLeft,
|
|
99
|
+
behindTextGradient: behindTextGradient,
|
|
100
|
+
blackPlayButton: blackPlayButton,
|
|
101
|
+
thisVideoSrc: thisVideoSrc,
|
|
102
|
+
thisPoster: thisPoster,
|
|
103
|
+
showPosterAfterPlaying: showPosterAfterPlaying,
|
|
104
|
+
autoPlay: autoPlay,
|
|
105
|
+
loop: loop
|
|
106
|
+
}))), /*#__PURE__*/_react.default.createElement(_Promo.Wrapper, {
|
|
107
|
+
copyLeft: copyLeft
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_Promo.Gradient, {
|
|
109
|
+
hasVideo: hasVideo,
|
|
110
|
+
behindTextGradient: behindTextGradient,
|
|
111
|
+
copyLeft: copyLeft
|
|
41
112
|
}, /*#__PURE__*/_react.default.createElement(_Promo.Copy, {
|
|
42
|
-
position: position
|
|
43
|
-
|
|
113
|
+
position: position,
|
|
114
|
+
hasVideo: hasVideo,
|
|
115
|
+
behindTextGradient: behindTextGradient
|
|
116
|
+
}, children))));
|
|
44
117
|
};
|
|
45
118
|
|
|
46
119
|
Promo.defaultProps = {
|
|
47
120
|
backgroundColor: 'white',
|
|
48
|
-
|
|
121
|
+
copyLeft: false,
|
|
49
122
|
imageSet: null,
|
|
50
123
|
imageLow: null,
|
|
51
124
|
image: null,
|
|
52
125
|
imageAltText: '',
|
|
53
126
|
children: null,
|
|
54
|
-
position: 'none'
|
|
127
|
+
position: 'none',
|
|
128
|
+
autoPlay: true,
|
|
129
|
+
loop: true,
|
|
130
|
+
poster: null,
|
|
131
|
+
mobilePoster: null,
|
|
132
|
+
videoSrc: null,
|
|
133
|
+
mobileVideoSrc: null,
|
|
134
|
+
showPosterAfterPlaying: true,
|
|
135
|
+
behindTextGradient: 'none',
|
|
136
|
+
blackPlayButton: false
|
|
55
137
|
};
|
|
56
138
|
var _default = Promo;
|
|
57
139
|
exports.default = _default;
|
|
@@ -14,8 +14,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
14
14
|
image={defaultData.promoImage}
|
|
15
15
|
imageLow={defaultData.promoImage}
|
|
16
16
|
imageAltText=""
|
|
17
|
-
|
|
18
|
-
hasOverlay={true}
|
|
17
|
+
copyLeft={true}
|
|
19
18
|
position="upper"
|
|
20
19
|
>
|
|
21
20
|
<Text
|
|
@@ -50,8 +49,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
50
49
|
image={defaultData.promoImage}
|
|
51
50
|
imageLow={defaultData.promoImage}
|
|
52
51
|
imageAltText=""
|
|
53
|
-
|
|
54
|
-
hasOverlay={true}
|
|
52
|
+
copyLeft={true}
|
|
55
53
|
position="end"
|
|
56
54
|
>
|
|
57
55
|
<Text
|
|
@@ -86,8 +84,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
86
84
|
image={defaultData.promoImage}
|
|
87
85
|
imageLow={defaultData.promoImage}
|
|
88
86
|
imageAltText=""
|
|
89
|
-
|
|
90
|
-
hasOverlay={true}
|
|
87
|
+
copyLeft={true}
|
|
91
88
|
position="lower"
|
|
92
89
|
>
|
|
93
90
|
<Text
|
|
@@ -122,8 +119,7 @@ import Link from '../../Atoms/Link/Link';
|
|
|
122
119
|
image={defaultData.promoImage}
|
|
123
120
|
imageLow={defaultData.promoImage}
|
|
124
121
|
imageAltText=""
|
|
125
|
-
|
|
126
|
-
hasOverlay={true}
|
|
122
|
+
copyLeft={true}
|
|
127
123
|
>
|
|
128
124
|
<Text
|
|
129
125
|
tag="h1"
|
|
@@ -149,3 +145,251 @@ import Link from '../../Atoms/Link/Link';
|
|
|
149
145
|
</Promo>
|
|
150
146
|
</div>
|
|
151
147
|
```
|
|
148
|
+
|
|
149
|
+
Promo w/Video
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
|
|
153
|
+
import Link from '../../Atoms/Link/Link';
|
|
154
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
155
|
+
import mobilePoster from '../../../styleguide/assets/mobileVideoPosterImage.png';
|
|
156
|
+
const videoSrc =
|
|
157
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
158
|
+
|
|
159
|
+
let mobileVideoSrc = 'https://samplelib.com/lib/preview/mp4/sample-10s.mp4';
|
|
160
|
+
|
|
161
|
+
<div>
|
|
162
|
+
<Text tag="h2" size="xl" color="black">
|
|
163
|
+
Promo Upper w/Video (autoplay and loop, black text gradient overlay)
|
|
164
|
+
</Text>
|
|
165
|
+
<Promo
|
|
166
|
+
backgroundColor="blue_dark"
|
|
167
|
+
imageSet={defaultData.promoImage}
|
|
168
|
+
image={defaultData.promoImage}
|
|
169
|
+
imageLow={defaultData.promoImage}
|
|
170
|
+
imageAltText=""
|
|
171
|
+
copyLeft={true}
|
|
172
|
+
position="upper"
|
|
173
|
+
videoSrc={videoSrc}
|
|
174
|
+
poster={poster}
|
|
175
|
+
loop={true}
|
|
176
|
+
autoplay={true}
|
|
177
|
+
behindTextGradient='black'
|
|
178
|
+
>
|
|
179
|
+
<Text
|
|
180
|
+
tag="h1"
|
|
181
|
+
color="white"
|
|
182
|
+
size="super"
|
|
183
|
+
family="Anton"
|
|
184
|
+
uppercase
|
|
185
|
+
weight="normal"
|
|
186
|
+
>
|
|
187
|
+
Curabitur pretium tincidunt lacus
|
|
188
|
+
</Text>
|
|
189
|
+
<Text tag="p" color="white">
|
|
190
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
191
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
192
|
+
</Text>
|
|
193
|
+
<span>
|
|
194
|
+
<Link href="/" type="button" color="white">
|
|
195
|
+
<Text>
|
|
196
|
+
Show me this
|
|
197
|
+
</Text>
|
|
198
|
+
</Link>
|
|
199
|
+
</span>
|
|
200
|
+
</Promo>
|
|
201
|
+
|
|
202
|
+
<br />
|
|
203
|
+
|
|
204
|
+
<Text tag="h2" size="xl" color="black">
|
|
205
|
+
Promo End w/Video (loop only, no text gradient overlay)
|
|
206
|
+
</Text>
|
|
207
|
+
<Promo
|
|
208
|
+
backgroundColor="blue_dark"
|
|
209
|
+
imageSet={defaultData.promoImage}
|
|
210
|
+
image={defaultData.promoImage}
|
|
211
|
+
imageLow={defaultData.promoImage}
|
|
212
|
+
imageAltText=""
|
|
213
|
+
copyLeft={true}
|
|
214
|
+
position="end"
|
|
215
|
+
videoSrc={videoSrc}
|
|
216
|
+
poster={poster}
|
|
217
|
+
loop={true}
|
|
218
|
+
autoPlay={false}
|
|
219
|
+
>
|
|
220
|
+
<Text
|
|
221
|
+
tag="h1"
|
|
222
|
+
color="white"
|
|
223
|
+
size="super"
|
|
224
|
+
family="Anton"
|
|
225
|
+
uppercase
|
|
226
|
+
weight="normal"
|
|
227
|
+
>
|
|
228
|
+
Curabitur pretium tincidunt lacus
|
|
229
|
+
</Text>
|
|
230
|
+
<Text tag="p" color="white">
|
|
231
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
232
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
233
|
+
</Text>
|
|
234
|
+
<span>
|
|
235
|
+
<Link href="/" type="button" color="white">
|
|
236
|
+
<Text>
|
|
237
|
+
Show me this
|
|
238
|
+
</Text>
|
|
239
|
+
</Link>
|
|
240
|
+
</span>
|
|
241
|
+
</Promo>
|
|
242
|
+
|
|
243
|
+
<br />
|
|
244
|
+
|
|
245
|
+
<Text tag="h2" size="xl" color="black">
|
|
246
|
+
Promo Lower w/Video (autoplay only, white text gradient overlay)
|
|
247
|
+
</Text>
|
|
248
|
+
<Promo
|
|
249
|
+
backgroundColor="blue_light"
|
|
250
|
+
imageSet={defaultData.promoImage}
|
|
251
|
+
image={defaultData.promoImage}
|
|
252
|
+
imageLow={defaultData.promoImage}
|
|
253
|
+
imageAltText=""
|
|
254
|
+
copyLeft={true}
|
|
255
|
+
position="lower"
|
|
256
|
+
videoSrc={videoSrc}
|
|
257
|
+
poster={poster}
|
|
258
|
+
loop={false}
|
|
259
|
+
autoPlay={true}
|
|
260
|
+
behindTextGradient='white'
|
|
261
|
+
>
|
|
262
|
+
<Text
|
|
263
|
+
tag="h1"
|
|
264
|
+
color="black"
|
|
265
|
+
size="super"
|
|
266
|
+
family="Anton"
|
|
267
|
+
uppercase
|
|
268
|
+
weight="normal"
|
|
269
|
+
>
|
|
270
|
+
Curabitur pretium tincidunt lacus
|
|
271
|
+
</Text>
|
|
272
|
+
<Text tag="p" color="black">
|
|
273
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
274
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
275
|
+
</Text>
|
|
276
|
+
<span>
|
|
277
|
+
<Link href="/" type="button" color="black">
|
|
278
|
+
<Text>
|
|
279
|
+
Show me this
|
|
280
|
+
</Text>
|
|
281
|
+
</Link>
|
|
282
|
+
</span>
|
|
283
|
+
</Promo>
|
|
284
|
+
|
|
285
|
+
<br />
|
|
286
|
+
<Text tag="h2" size="xl" color="black">
|
|
287
|
+
Promo None w/Video (no loop or autoplay, no text gradient overlay, copy right aligned)
|
|
288
|
+
</Text>
|
|
289
|
+
<Promo
|
|
290
|
+
backgroundColor="blue_dark"
|
|
291
|
+
imageSet={defaultData.promoImage}
|
|
292
|
+
image={defaultData.promoImage}
|
|
293
|
+
imageLow={defaultData.promoImage}
|
|
294
|
+
imageAltText=""
|
|
295
|
+
copyLeft={false}
|
|
296
|
+
videoSrc={videoSrc}
|
|
297
|
+
poster={poster}
|
|
298
|
+
loop={false}
|
|
299
|
+
autoPlay={false}
|
|
300
|
+
>
|
|
301
|
+
<Text
|
|
302
|
+
tag="h1"
|
|
303
|
+
color="white"
|
|
304
|
+
size="super"
|
|
305
|
+
family="Anton"
|
|
306
|
+
uppercase
|
|
307
|
+
weight="normal"
|
|
308
|
+
>
|
|
309
|
+
Curabitur pretium tincidunt lacus
|
|
310
|
+
</Text>
|
|
311
|
+
<Text tag="p" color="white">
|
|
312
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
313
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
314
|
+
</Text>
|
|
315
|
+
<span>
|
|
316
|
+
<Link href="/" type="button" color="white">
|
|
317
|
+
<Text>
|
|
318
|
+
Show me this
|
|
319
|
+
</Text>
|
|
320
|
+
</Link>
|
|
321
|
+
</span>
|
|
322
|
+
</Promo>
|
|
323
|
+
|
|
324
|
+
<Text tag="h2" size="xl" color="black">
|
|
325
|
+
Promo None w/Video (no loop or autoplay, white text gradient overlay, different videos and posters for mobile and desktop)
|
|
326
|
+
</Text>
|
|
327
|
+
<Promo
|
|
328
|
+
backgroundColor="blue_light"
|
|
329
|
+
imageSet={defaultData.promoImage}
|
|
330
|
+
image={defaultData.promoImage}
|
|
331
|
+
imageLow={defaultData.promoImage}
|
|
332
|
+
imageAltText=""
|
|
333
|
+
copyLeft={true}
|
|
334
|
+
videoSrc={videoSrc}
|
|
335
|
+
mobileVideoSrc={mobileVideoSrc}
|
|
336
|
+
poster={poster}
|
|
337
|
+
mobilePoster={mobilePoster}
|
|
338
|
+
loop={false}
|
|
339
|
+
autoPlay={false}
|
|
340
|
+
behindTextGradient='white'
|
|
341
|
+
>
|
|
342
|
+
<Text
|
|
343
|
+
tag="h1"
|
|
344
|
+
color="black"
|
|
345
|
+
size="super"
|
|
346
|
+
family="Anton"
|
|
347
|
+
uppercase
|
|
348
|
+
weight="normal"
|
|
349
|
+
>
|
|
350
|
+
Curabitur pretium tincidunt lacus
|
|
351
|
+
</Text>
|
|
352
|
+
<Text tag="p" color="black">
|
|
353
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
|
|
354
|
+
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
|
|
355
|
+
</Text>
|
|
356
|
+
<span>
|
|
357
|
+
<Link href="/" type="button" color="black">
|
|
358
|
+
<Text>
|
|
359
|
+
Show me this
|
|
360
|
+
</Text>
|
|
361
|
+
</Link>
|
|
362
|
+
</span>
|
|
363
|
+
</Promo>
|
|
364
|
+
|
|
365
|
+
<Text tag="h2" size="xl" color="black">
|
|
366
|
+
Promo None w/Video (no loop or autoplay, white text gradient overlay, mobile-only video and poster, black play button)
|
|
367
|
+
</Text>
|
|
368
|
+
<Promo
|
|
369
|
+
backgroundColor="blue_light"
|
|
370
|
+
imageSet={defaultData.promoImage}
|
|
371
|
+
image={defaultData.promoImage}
|
|
372
|
+
imageLow={defaultData.promoImage}
|
|
373
|
+
imageAltText=""
|
|
374
|
+
copyLeft={true}
|
|
375
|
+
mobileVideoSrc={mobileVideoSrc}
|
|
376
|
+
mobilePoster={mobilePoster}
|
|
377
|
+
loop={false}
|
|
378
|
+
autoPlay={false}
|
|
379
|
+
behindTextGradient='white'
|
|
380
|
+
blackPlayButton={true}
|
|
381
|
+
>
|
|
382
|
+
<Text
|
|
383
|
+
tag="h1"
|
|
384
|
+
color="black"
|
|
385
|
+
size="super"
|
|
386
|
+
family="Anton"
|
|
387
|
+
uppercase
|
|
388
|
+
weight="normal"
|
|
389
|
+
>
|
|
390
|
+
One-Line Special
|
|
391
|
+
</Text>
|
|
392
|
+
</Promo>
|
|
393
|
+
|
|
394
|
+
</div>
|
|
395
|
+
```
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.Media = exports.Copy = exports.Wrapper = exports.Container = void 0;
|
|
8
|
+
exports.Gradient = exports.Video = exports.Media = exports.Copy = exports.Wrapper = exports.Container = void 0;
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
11
|
|
|
@@ -42,9 +42,9 @@ exports.Container = Container;
|
|
|
42
42
|
var Wrapper = _styledComponents.default.div.withConfig({
|
|
43
43
|
displayName: "Promostyle__Wrapper",
|
|
44
44
|
componentId: "sc-kk4nna-1"
|
|
45
|
-
})(["width:100%;max-width:", ";height:100%;left:0;right:0;margin:0 auto;display:flex;align-items:center;", ";", "{min-height:calc(100vh - 90px);}"], _size.container.medium, function (_ref5) {
|
|
46
|
-
var
|
|
47
|
-
return !
|
|
45
|
+
})(["width:100%;max-width:", ";height:100%;left:0;right:0;margin:0 auto;display:flex;align-items:center;position:relative;", ";", "{min-height:calc(100vh - 90px);}"], _size.container.medium, function (_ref5) {
|
|
46
|
+
var copyLeft = _ref5.copyLeft;
|
|
47
|
+
return !copyLeft && 'justify-content: flex-end';
|
|
48
48
|
}, (0, _size.media)('medium'));
|
|
49
49
|
|
|
50
50
|
exports.Wrapper = Wrapper;
|
|
@@ -52,7 +52,7 @@ exports.Wrapper = Wrapper;
|
|
|
52
52
|
var Copy = _styledComponents.default.div.withConfig({
|
|
53
53
|
displayName: "Promostyle__Copy",
|
|
54
54
|
componentId: "sc-kk4nna-2"
|
|
55
|
-
})(["width:100%;padding:", " ", " ", ";", ";", "{width:
|
|
55
|
+
})(["width:100%;padding:", " ", " ", ";", ";", "{width:100%;padding:", " ", ";}", ""], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('xl'), (0, _zIndex.default)('low'), (0, _size.media)('medium'), (0, _spacing.default)('xxl'), (0, _spacing.default)('m'), function (_ref6) {
|
|
56
56
|
var position = _ref6.position;
|
|
57
57
|
return position === 'lower' && (0, _styledComponents.css)(["padding:", " ", ";", "{padding:6rem ", ";margin-top:6rem;}"], (0, _spacing.default)('xl'), (0, _spacing.default)('m'), (0, _size.media)('medium'), (0, _spacing.default)('m'));
|
|
58
58
|
});
|
|
@@ -64,4 +64,29 @@ var Media = _styledComponents.default.div.withConfig({
|
|
|
64
64
|
componentId: "sc-kk4nna-3"
|
|
65
65
|
})(["width:100%;height:auto;img{object-position:center;}", "{height:100%;position:absolute;}"], (0, _size.media)('medium'));
|
|
66
66
|
|
|
67
|
-
exports.Media = Media;
|
|
67
|
+
exports.Media = Media;
|
|
68
|
+
|
|
69
|
+
var Video = _styledComponents.default.video.attrs(function () {
|
|
70
|
+
return {
|
|
71
|
+
playsInline: true
|
|
72
|
+
};
|
|
73
|
+
}).withConfig({
|
|
74
|
+
displayName: "Promostyle__Video",
|
|
75
|
+
componentId: "sc-kk4nna-4"
|
|
76
|
+
})(["width:100%;height:100%;object-fit:cover;"]);
|
|
77
|
+
|
|
78
|
+
exports.Video = Video;
|
|
79
|
+
|
|
80
|
+
var Gradient = _styledComponents.default.div.withConfig({
|
|
81
|
+
displayName: "Promostyle__Gradient",
|
|
82
|
+
componentId: "sc-kk4nna-5"
|
|
83
|
+
})(["width:100%;height:100%;display:flex;align-items:center;", "{width:50%;position:absolute;top:0;left:0;", ";", ";}"], (0, _size.media)('medium'), function (_ref7) {
|
|
84
|
+
var copyLeft = _ref7.copyLeft;
|
|
85
|
+
return !copyLeft && (0, _styledComponents.css)(["left:auto;right:0;"]);
|
|
86
|
+
}, function (_ref8) {
|
|
87
|
+
var hasVideo = _ref8.hasVideo,
|
|
88
|
+
behindTextGradient = _ref8.behindTextGradient;
|
|
89
|
+
return hasVideo !== false && behindTextGradient !== 'none' && (0, _styledComponents.css)(["overflow:hidden;background-color:", ";box-shadow:0px 0px 50px 60px ", ";"], behindTextGradient === 'black' ? 'rgba(0,0,0,0.5)' : 'rgba(255, 255, 255, 0.5)', behindTextGradient === 'black' ? 'rgba(0,0,0,0.5)' : 'rgba(255, 255, 255, 0.5)');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
exports.Gradient = Gradient;
|
|
@@ -22,7 +22,7 @@ it('renders Promo correctly', function () {
|
|
|
22
22
|
imageSet: defaultData.promoImage,
|
|
23
23
|
image: defaultData.promoImage,
|
|
24
24
|
imageAltText: "",
|
|
25
|
-
|
|
25
|
+
copyLeft: false
|
|
26
26
|
}, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
27
27
|
tag: "h1",
|
|
28
28
|
color: "white",
|
|
@@ -46,7 +46,7 @@ it('renders Promo correctly end position', function () {
|
|
|
46
46
|
imageSet: defaultData.promoImage,
|
|
47
47
|
image: defaultData.promoImage,
|
|
48
48
|
imageAltText: "",
|
|
49
|
-
|
|
49
|
+
copyLeft: false,
|
|
50
50
|
position: "end"
|
|
51
51
|
}, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
52
52
|
tag: "h1",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _PromoVideoButton = require("./_PromoVideoButton.style");
|
|
17
|
+
|
|
18
|
+
var _excluded = ["videoProgress"];
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
var ProgressRing = function ProgressRing(_ref) {
|
|
25
|
+
var videoProgress = _ref.videoProgress,
|
|
26
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
27
|
+
var thisStroke = 4;
|
|
28
|
+
var thisRadius = 28;
|
|
29
|
+
var initNormRadius = thisRadius - thisStroke * 2;
|
|
30
|
+
var thisCircumference = initNormRadius * 2 * Math.PI;
|
|
31
|
+
|
|
32
|
+
var _useState = (0, _react.useState)(initNormRadius * 2 * Math.PI),
|
|
33
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
|
+
thisDashOffset = _useState2[0],
|
|
35
|
+
setThisDashOffset = _useState2[1];
|
|
36
|
+
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
var offset = thisCircumference - videoProgress / 100 * thisCircumference;
|
|
39
|
+
setThisDashOffset(offset);
|
|
40
|
+
}, [videoProgress, thisCircumference]);
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_PromoVideoButton.ProgressRingWrapper, {
|
|
42
|
+
videoProgress: videoProgress
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_PromoVideoButton.ProgressRingSVG, {
|
|
44
|
+
height: thisRadius * 2,
|
|
45
|
+
width: thisRadius * 2
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_PromoVideoButton.ProgressRingCircle, Object.assign({
|
|
47
|
+
strokeDasharray: "".concat(thisCircumference, " ").concat(thisCircumference),
|
|
48
|
+
strokeDashOffsetStyle: thisDashOffset,
|
|
49
|
+
strokeWidth: "".concat(thisStroke),
|
|
50
|
+
r: "".concat(initNormRadius),
|
|
51
|
+
cx: "".concat(thisRadius),
|
|
52
|
+
cy: "".concat(thisRadius)
|
|
53
|
+
}, rest))));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var _default = ProgressRing;
|
|
57
|
+
exports.default = _default;
|