@comicrelief/component-library 7.21.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/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/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/package.json +1 -1
- 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/styleguide/assets/mobileVideoPosterImage.png +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
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 _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _ProgressRing = _interopRequireDefault(require("./_ProgressRing"));
|
|
15
|
+
|
|
16
|
+
var _PromoVideoButton = require("./_PromoVideoButton.style");
|
|
17
|
+
|
|
18
|
+
var _excluded = ["togglePlay"];
|
|
19
|
+
|
|
20
|
+
var PromoVideoButton = function PromoVideoButton(_ref) {
|
|
21
|
+
var togglePlay = _ref.togglePlay,
|
|
22
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_PromoVideoButton.PlayButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_PromoVideoButton.PlayButton, Object.assign({
|
|
24
|
+
onClick: function onClick() {
|
|
25
|
+
togglePlay();
|
|
26
|
+
}
|
|
27
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_PromoVideoButton.Icon, rest), /*#__PURE__*/_react.default.createElement(_ProgressRing.default, rest)));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var _default = PromoVideoButton;
|
|
31
|
+
exports.default = _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Icon = exports.PlayButtonWrapper = exports.PlayButton = exports.ProgressRingCircle = exports.ProgressRingSVG = exports.ProgressRingWrapper = void 0;
|
|
9
|
+
|
|
10
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
|
+
|
|
12
|
+
var _PlayWhite = _interopRequireDefault(require("./assets/Play--white.svg"));
|
|
13
|
+
|
|
14
|
+
var _PauseWhite = _interopRequireDefault(require("./assets/Pause--white.svg"));
|
|
15
|
+
|
|
16
|
+
var _PlayBlack = _interopRequireDefault(require("./assets/Play--black.svg"));
|
|
17
|
+
|
|
18
|
+
var _PauseBlack = _interopRequireDefault(require("./assets/Pause--black.svg"));
|
|
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 PlayButton = _styledComponents.default.button.withConfig({
|
|
25
|
+
displayName: "_PromoVideoButtonstyle__PlayButton",
|
|
26
|
+
componentId: "sc-17cm3uc-0"
|
|
27
|
+
})(["display:flex;width:50px;height:50px;position:absolute;top:10px;right:10px;align-items:center;justify-content:center;border:0;padding:0;margin:0;border-radius:50%;background:", ";opacity:0.75;transition:opacity 0.2s;&:hover,&:focus{opacity:1.0;}&:focus-visible{outline-style:outset;outline-width:medium;}", " ", " @media ", "{top:20px;right:20px;", "}"], function (_ref) {
|
|
28
|
+
var theme = _ref.theme;
|
|
29
|
+
return theme.color('black');
|
|
30
|
+
}, function (_ref2) {
|
|
31
|
+
var lightColouredVideo = _ref2.lightColouredVideo;
|
|
32
|
+
return !lightColouredVideo && (0, _styledComponents.css)(["background:", ";"], function (_ref3) {
|
|
33
|
+
var theme = _ref3.theme;
|
|
34
|
+
return theme.color('white');
|
|
35
|
+
});
|
|
36
|
+
}, function (_ref4) {
|
|
37
|
+
var copyLeft = _ref4.copyLeft;
|
|
38
|
+
return !copyLeft && (0, _styledComponents.css)(["right:auto;left:10px;"]);
|
|
39
|
+
}, function (_ref5) {
|
|
40
|
+
var theme = _ref5.theme;
|
|
41
|
+
return theme.breakpoint('medium');
|
|
42
|
+
}, function (_ref6) {
|
|
43
|
+
var copyLeft = _ref6.copyLeft;
|
|
44
|
+
return !copyLeft && (0, _styledComponents.css)(["right:auto;left:20px;"]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
exports.PlayButton = PlayButton;
|
|
48
|
+
|
|
49
|
+
var PlayButtonWrapper = _styledComponents.default.div.withConfig({
|
|
50
|
+
displayName: "_PromoVideoButtonstyle__PlayButtonWrapper",
|
|
51
|
+
componentId: "sc-17cm3uc-1"
|
|
52
|
+
})(["width:100%;height:100%;position:absolute;top:0;left:0;"]);
|
|
53
|
+
|
|
54
|
+
exports.PlayButtonWrapper = PlayButtonWrapper;
|
|
55
|
+
|
|
56
|
+
var ProgressRingWrapper = _styledComponents.default.span.withConfig({
|
|
57
|
+
displayName: "_PromoVideoButtonstyle__ProgressRingWrapper",
|
|
58
|
+
componentId: "sc-17cm3uc-2"
|
|
59
|
+
})(["position:absolute;width:100%;height:100%;display:flex;"]);
|
|
60
|
+
|
|
61
|
+
exports.ProgressRingWrapper = ProgressRingWrapper;
|
|
62
|
+
|
|
63
|
+
var ProgressRingSVG = _styledComponents.default.svg.withConfig({
|
|
64
|
+
displayName: "_PromoVideoButtonstyle__ProgressRingSVG",
|
|
65
|
+
componentId: "sc-17cm3uc-3"
|
|
66
|
+
})([""]);
|
|
67
|
+
|
|
68
|
+
exports.ProgressRingSVG = ProgressRingSVG;
|
|
69
|
+
|
|
70
|
+
var ProgressRingCircle = _styledComponents.default.circle.withConfig({
|
|
71
|
+
displayName: "_PromoVideoButtonstyle__ProgressRingCircle",
|
|
72
|
+
componentId: "sc-17cm3uc-4"
|
|
73
|
+
})(["z-index:100;transition:stroke-dashoffset 0.5s;transform:rotate(-90deg);transform-origin:50% 50%;stroke-dashoffset:", ";stroke:white;fill:transparent;", " ", ""], function (_ref7) {
|
|
74
|
+
var strokeDashOffsetStyle = _ref7.strokeDashOffsetStyle;
|
|
75
|
+
return strokeDashOffsetStyle;
|
|
76
|
+
}, function (_ref8) {
|
|
77
|
+
var lightColouredVideo = _ref8.lightColouredVideo;
|
|
78
|
+
return !lightColouredVideo && (0, _styledComponents.css)(["stroke:", ";"], function (_ref9) {
|
|
79
|
+
var theme = _ref9.theme;
|
|
80
|
+
return theme.color('black');
|
|
81
|
+
});
|
|
82
|
+
}, function (_ref10) {
|
|
83
|
+
var isRestarting = _ref10.isRestarting;
|
|
84
|
+
return isRestarting && (0, _styledComponents.css)(["transition:none;"]);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
exports.ProgressRingCircle = ProgressRingCircle;
|
|
88
|
+
|
|
89
|
+
var Icon = _styledComponents.default.span.withConfig({
|
|
90
|
+
displayName: "_PromoVideoButtonstyle__Icon",
|
|
91
|
+
componentId: "sc-17cm3uc-5"
|
|
92
|
+
})(["height:50px;width:50px;background:no-repeat center/50% url(", ") transparent;", " ", " ", " ", ""], _PlayWhite.default, function (_ref11) {
|
|
93
|
+
var lightColouredVideo = _ref11.lightColouredVideo,
|
|
94
|
+
isPlaying = _ref11.isPlaying;
|
|
95
|
+
return lightColouredVideo && !isPlaying && (0, _styledComponents.css)(["background-image:url(", ");"], _PlayWhite.default);
|
|
96
|
+
}, function (_ref12) {
|
|
97
|
+
var lightColouredVideo = _ref12.lightColouredVideo,
|
|
98
|
+
isPlaying = _ref12.isPlaying;
|
|
99
|
+
return lightColouredVideo && isPlaying && (0, _styledComponents.css)(["background-image:url(", ");"], _PauseWhite.default);
|
|
100
|
+
}, function (_ref13) {
|
|
101
|
+
var lightColouredVideo = _ref13.lightColouredVideo,
|
|
102
|
+
isPlaying = _ref13.isPlaying;
|
|
103
|
+
return !lightColouredVideo && !isPlaying && (0, _styledComponents.css)(["background-image:url(", ");"], _PlayBlack.default);
|
|
104
|
+
}, function (_ref14) {
|
|
105
|
+
var lightColouredVideo = _ref14.lightColouredVideo,
|
|
106
|
+
isPlaying = _ref14.isPlaying;
|
|
107
|
+
return !lightColouredVideo && isPlaying && (0, _styledComponents.css)(["background-image:url(", ");"], _PauseBlack.default);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
exports.Icon = Icon;
|
|
@@ -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>
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import PromoVideo from './_PromoVideo';
|
|
4
|
+
import { sizes } from '../../../theme/shared/breakpoint';
|
|
5
|
+
|
|
3
6
|
import Picture from '../../Atoms/Picture/Picture';
|
|
4
7
|
|
|
5
8
|
import {
|
|
@@ -7,21 +10,60 @@ import {
|
|
|
7
10
|
} from './Promo.style';
|
|
8
11
|
|
|
9
12
|
const Promo = ({
|
|
10
|
-
|
|
13
|
+
copyLeft,
|
|
11
14
|
backgroundColor,
|
|
12
15
|
imageLow,
|
|
13
16
|
imageSet,
|
|
14
17
|
image,
|
|
15
18
|
imageAltText,
|
|
16
19
|
children,
|
|
17
|
-
position
|
|
20
|
+
position,
|
|
21
|
+
autoPlay,
|
|
22
|
+
loop,
|
|
23
|
+
poster,
|
|
24
|
+
mobilePoster,
|
|
25
|
+
showPosterAfterPlaying,
|
|
26
|
+
videoSrc,
|
|
27
|
+
mobileVideoSrc,
|
|
28
|
+
lightColouredVideo
|
|
18
29
|
}) => {
|
|
19
|
-
|
|
30
|
+
// Store the appropriate prop in state, dependent on the breakpoint
|
|
31
|
+
const [thisVideoSrc, setThisVideoSrc] = useState(null);
|
|
32
|
+
const [thisPoster, setThisPoster] = useState(null);
|
|
33
|
+
|
|
34
|
+
// Let either field define this, just in case
|
|
35
|
+
const hasVideo = Boolean(videoSrc || mobileVideoSrc);
|
|
36
|
+
// A 'video-y' Promo will override and ignore any 'non-Video' images;
|
|
37
|
+
// none of these fields are required so we have to handle them accordingly:
|
|
38
|
+
const hasImage = Boolean(imageSet && !hasVideo);
|
|
39
|
+
|
|
40
|
+
// Runs on initial load:
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (hasVideo) {
|
|
43
|
+
// Checks size on load ONLY; don't want to mess about with listeners:
|
|
44
|
+
const isDesktop = window.innerWidth >= sizes.nav; // 1024+ px
|
|
45
|
+
let currentPoster; let currentSrc;
|
|
46
|
+
|
|
47
|
+
// If we've got both desktop AND mobile videos, let the
|
|
48
|
+
// *current* screen width define which video src to use:
|
|
49
|
+
if (videoSrc && mobileVideoSrc) {
|
|
50
|
+
currentSrc = isDesktop ? videoSrc : mobileVideoSrc;
|
|
51
|
+
currentPoster = isDesktop ? poster : mobilePoster;
|
|
52
|
+
} else {
|
|
53
|
+
// Else, pick whatever we DO actually have:
|
|
54
|
+
currentSrc = videoSrc || mobileVideoSrc;
|
|
55
|
+
currentPoster = poster || mobilePoster;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setThisVideoSrc(currentSrc);
|
|
59
|
+
setThisPoster(currentPoster);
|
|
60
|
+
}
|
|
61
|
+
}, [hasVideo, videoSrc, mobileVideoSrc, mobilePoster, poster]);
|
|
20
62
|
|
|
21
63
|
return (
|
|
22
64
|
<Container backgroundColor={backgroundColor} position={position}>
|
|
23
|
-
{
|
|
24
|
-
|
|
65
|
+
<Media imageRight={copyLeft}>
|
|
66
|
+
{(hasImage && !hasVideo) && (
|
|
25
67
|
<Picture
|
|
26
68
|
alt={imageAltText}
|
|
27
69
|
imageLow={imageLow}
|
|
@@ -31,10 +73,28 @@ const Promo = ({
|
|
|
31
73
|
width="100%"
|
|
32
74
|
height="100%"
|
|
33
75
|
/>
|
|
76
|
+
)}
|
|
77
|
+
{/* If no poster image is supplied, it'll gracefully
|
|
78
|
+
fall back to the first frame, so only checking for a src here */}
|
|
79
|
+
{(hasVideo && thisVideoSrc) && (
|
|
80
|
+
<>
|
|
81
|
+
<PromoVideo
|
|
82
|
+
copyLeft={copyLeft}
|
|
83
|
+
lightColouredVideo={lightColouredVideo}
|
|
84
|
+
thisVideoSrc={thisVideoSrc}
|
|
85
|
+
thisPoster={thisPoster}
|
|
86
|
+
showPosterAfterPlaying={showPosterAfterPlaying}
|
|
87
|
+
autoPlay={autoPlay}
|
|
88
|
+
loop={loop}
|
|
89
|
+
/>
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
34
92
|
</Media>
|
|
35
|
-
|
|
36
|
-
<Wrapper
|
|
37
|
-
<Copy position={position}
|
|
93
|
+
|
|
94
|
+
<Wrapper copyLeft={copyLeft}>
|
|
95
|
+
<Copy position={position} hasVideo={hasVideo} lightColouredVideo={lightColouredVideo}>
|
|
96
|
+
{children}
|
|
97
|
+
</Copy>
|
|
38
98
|
</Wrapper>
|
|
39
99
|
</Container>
|
|
40
100
|
);
|
|
@@ -42,24 +102,40 @@ const Promo = ({
|
|
|
42
102
|
|
|
43
103
|
Promo.propTypes = {
|
|
44
104
|
backgroundColor: PropTypes.string,
|
|
45
|
-
|
|
105
|
+
copyLeft: PropTypes.bool,
|
|
46
106
|
imageLow: PropTypes.string,
|
|
47
107
|
imageSet: PropTypes.string,
|
|
48
108
|
image: PropTypes.string,
|
|
49
109
|
imageAltText: PropTypes.string,
|
|
50
110
|
children: PropTypes.node,
|
|
51
|
-
position: PropTypes.oneOf(['upper', 'lower', 'end', 'none'])
|
|
111
|
+
position: PropTypes.oneOf(['upper', 'lower', 'end', 'none']),
|
|
112
|
+
autoPlay: PropTypes.bool,
|
|
113
|
+
loop: PropTypes.bool,
|
|
114
|
+
videoSrc: PropTypes.string,
|
|
115
|
+
mobileVideoSrc: PropTypes.string,
|
|
116
|
+
poster: PropTypes.string,
|
|
117
|
+
mobilePoster: PropTypes.string,
|
|
118
|
+
showPosterAfterPlaying: PropTypes.bool,
|
|
119
|
+
lightColouredVideo: PropTypes.bool
|
|
52
120
|
};
|
|
53
121
|
|
|
54
122
|
Promo.defaultProps = {
|
|
55
123
|
backgroundColor: 'white',
|
|
56
|
-
|
|
124
|
+
copyLeft: false,
|
|
57
125
|
imageSet: null,
|
|
58
126
|
imageLow: null,
|
|
59
127
|
image: null,
|
|
60
128
|
imageAltText: '',
|
|
61
129
|
children: null,
|
|
62
|
-
position: 'none'
|
|
130
|
+
position: 'none',
|
|
131
|
+
autoPlay: true,
|
|
132
|
+
loop: true,
|
|
133
|
+
poster: null,
|
|
134
|
+
mobilePoster: null,
|
|
135
|
+
videoSrc: null,
|
|
136
|
+
mobileVideoSrc: null,
|
|
137
|
+
showPosterAfterPlaying: true,
|
|
138
|
+
lightColouredVideo: false
|
|
63
139
|
};
|
|
64
140
|
|
|
65
141
|
export default Promo;
|
|
@@ -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
|
};
|