@comicrelief/component-library 7.18.3 → 7.19.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/.github/workflows/main.yml +4 -4
- package/.nvmrc +1 -0
- package/cypress/integration/components/Molecules/VideoBanner.spec.js +1 -1
- package/dist/components/Atoms/Select/Select.md +3 -4
- package/dist/components/Molecules/CardDs/CardDs.js +3 -2
- package/dist/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +2 -1
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +4 -3
- package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +2 -1
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +31 -8
- package/dist/components/Molecules/VideoBanner/VideoBanner.md +20 -1
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +5 -5
- package/dist/styleguide/assets/VideoBannerPosterImage.png +0 -0
- package/package.json +1 -1
- package/src/components/Atoms/Select/Select.md +3 -4
- package/src/components/Molecules/CardDs/CardDs.js +2 -1
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +2 -1
- package/src/components/Molecules/SingleMessageDS/SingleMessageDs.js +3 -2
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +2 -1
- package/src/components/Molecules/VideoBanner/VideoBanner.js +39 -9
- package/src/components/Molecules/VideoBanner/VideoBanner.md +20 -1
- package/src/components/Molecules/VideoBanner/VideoBanner.test.js +9 -8
- package/src/styleguide/assets/VideoBannerPosterImage.png +0 -0
- package/dist/styleguide/assets/poster.png +0 -0
- package/src/styleguide/assets/poster.png +0 -0
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
- name: Set up Node
|
|
14
14
|
uses: actions/setup-node@v3
|
|
15
15
|
with:
|
|
16
|
-
node-version:
|
|
16
|
+
node-version-file: '.nvmrc'
|
|
17
17
|
|
|
18
18
|
- name: Restore packages cache
|
|
19
19
|
uses: actions/cache@v3
|
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
- name: Set up Node
|
|
38
38
|
uses: actions/setup-node@v3
|
|
39
39
|
with:
|
|
40
|
-
node-version:
|
|
40
|
+
node-version-file: '.nvmrc'
|
|
41
41
|
|
|
42
42
|
- name: Restore packages cache
|
|
43
43
|
uses: actions/cache@v3
|
|
@@ -69,7 +69,7 @@ jobs:
|
|
|
69
69
|
- name: Set up Node
|
|
70
70
|
uses: actions/setup-node@v3
|
|
71
71
|
with:
|
|
72
|
-
node-version:
|
|
72
|
+
node-version-file: '.nvmrc'
|
|
73
73
|
|
|
74
74
|
# see https://github.com/marketplace/actions/cypress-io
|
|
75
75
|
- name: Run Cypress tests
|
|
@@ -110,7 +110,7 @@ jobs:
|
|
|
110
110
|
- name: Set up Node
|
|
111
111
|
uses: actions/setup-node@v3
|
|
112
112
|
with:
|
|
113
|
-
node-version:
|
|
113
|
+
node-version-file: '.nvmrc'
|
|
114
114
|
|
|
115
115
|
- name: Restore packages cache
|
|
116
116
|
uses: actions/cache@v3
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v16.20.0
|
|
@@ -35,7 +35,7 @@ describe('Video Banner component', () => {
|
|
|
35
35
|
|
|
36
36
|
describe('Video Banner section', () => {
|
|
37
37
|
beforeEach(() => {
|
|
38
|
-
cy.get('[data-testid="VideoBanner-example-
|
|
38
|
+
cy.get('[data-testid="VideoBanner-example-1"]')
|
|
39
39
|
.as('container')
|
|
40
40
|
.find('[data-preview="VideoBanner"]')
|
|
41
41
|
.as('preview');
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
<Select
|
|
6
6
|
label="Label"
|
|
7
7
|
description="Please choose an option"
|
|
8
|
+
// note: defaultValue is just using the built-in React defaultValue prop. It adds the HTML prop "selected" to one of the options elements. This is why defaultValue must be set to one of the existing options values:
|
|
9
|
+
defaultValue="Option four"
|
|
8
10
|
errorMsg=""
|
|
9
11
|
options={[
|
|
10
12
|
{ value: 'Option one', displayValue: 'The first option' },
|
|
11
|
-
{
|
|
12
|
-
value: 'Option two',
|
|
13
|
-
displayValue: 'The second option'
|
|
14
|
-
},
|
|
13
|
+
{ value: 'Option two', displayValue: 'The second option' },
|
|
15
14
|
{ value: 'Option three', displayValue: 'The third option' },
|
|
16
15
|
{ value: 'Option four', displayValue: 'The fourth option' }
|
|
17
16
|
]}
|
|
@@ -127,7 +127,7 @@ var CardDs = function CardDs(_ref14) {
|
|
|
127
127
|
tabIndex: "-1",
|
|
128
128
|
href: link,
|
|
129
129
|
target: target,
|
|
130
|
-
"data-cta-copy": linkLabel
|
|
130
|
+
"data-image-cta-copy": linkLabel
|
|
131
131
|
}, rest), Media);
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -151,7 +151,8 @@ var CardDs = function CardDs(_ref14) {
|
|
|
151
151
|
href: link,
|
|
152
152
|
target: target,
|
|
153
153
|
type: "button",
|
|
154
|
-
icon: icon
|
|
154
|
+
icon: icon,
|
|
155
|
+
"data-button-cta-copy": linkLabel
|
|
155
156
|
}, linkLabel)));
|
|
156
157
|
};
|
|
157
158
|
|
|
@@ -189,7 +189,7 @@ exports[`renders correctly 1`] = `
|
|
|
189
189
|
<a
|
|
190
190
|
aria-hidden="true"
|
|
191
191
|
className="c1"
|
|
192
|
-
data-cta-copy="Find out more"
|
|
192
|
+
data-image-cta-copy="Find out more"
|
|
193
193
|
href="/home"
|
|
194
194
|
tabIndex="-1"
|
|
195
195
|
target="_blank"
|
|
@@ -228,6 +228,7 @@ exports[`renders correctly 1`] = `
|
|
|
228
228
|
<a
|
|
229
229
|
className="c7"
|
|
230
230
|
color="red"
|
|
231
|
+
data-button-cta-copy="Find out more"
|
|
231
232
|
href="/home"
|
|
232
233
|
rel={null}
|
|
233
234
|
target="_self"
|
|
@@ -77,7 +77,7 @@ var SingleMessageDs = function SingleMessageDs(_ref) {
|
|
|
77
77
|
tabIndex: "-1",
|
|
78
78
|
href: link,
|
|
79
79
|
target: target,
|
|
80
|
-
"data-cta-copy": linkLabel
|
|
80
|
+
"data-image-cta-copy": linkLabel
|
|
81
81
|
}, rest), Media);
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -88,7 +88,7 @@ var SingleMessageDs = function SingleMessageDs(_ref) {
|
|
|
88
88
|
tabIndex: "-1",
|
|
89
89
|
href: youTubeId,
|
|
90
90
|
target: target,
|
|
91
|
-
"data-cta-copy": linkLabel
|
|
91
|
+
"data-image-cta-copy": linkLabel
|
|
92
92
|
}, rest, {
|
|
93
93
|
onClick: function onClick(e) {
|
|
94
94
|
setIsOpen(true);
|
|
@@ -159,7 +159,8 @@ var SingleMessageDs = function SingleMessageDs(_ref) {
|
|
|
159
159
|
href: link,
|
|
160
160
|
target: target,
|
|
161
161
|
type: "button",
|
|
162
|
-
icon: icon
|
|
162
|
+
icon: icon,
|
|
163
|
+
"data-button-cta-copy": linkLabel
|
|
163
164
|
}, linkLabel))), /*#__PURE__*/_react.default.createElement(_reactModal.default, {
|
|
164
165
|
isOpen: isOpen,
|
|
165
166
|
onRequestClose: closeModal,
|
package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap
CHANGED
|
@@ -234,7 +234,7 @@ exports[`renders correctly 1`] = `
|
|
|
234
234
|
<a
|
|
235
235
|
aria-hidden="true"
|
|
236
236
|
className="c1"
|
|
237
|
-
data-cta-copy="Check out the shop"
|
|
237
|
+
data-image-cta-copy="Check out the shop"
|
|
238
238
|
href="/home"
|
|
239
239
|
tabIndex="-1"
|
|
240
240
|
target="_blank"
|
|
@@ -286,6 +286,7 @@ exports[`renders correctly 1`] = `
|
|
|
286
286
|
<a
|
|
287
287
|
className="c11"
|
|
288
288
|
color="blue_dark"
|
|
289
|
+
data-button-cta-copy="Check out the shop"
|
|
289
290
|
href="/home"
|
|
290
291
|
rel={null}
|
|
291
292
|
target="_self"
|
|
@@ -17,10 +17,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
|
|
18
18
|
var Video = _styledComponents.default.video.attrs(function () {
|
|
19
19
|
return {
|
|
20
|
-
|
|
21
|
-
playsInline: true,
|
|
22
|
-
muted: true,
|
|
23
|
-
loop: false
|
|
20
|
+
playsInline: true
|
|
24
21
|
};
|
|
25
22
|
}).withConfig({
|
|
26
23
|
displayName: "VideoBanner__Video",
|
|
@@ -29,22 +26,48 @@ var Video = _styledComponents.default.video.attrs(function () {
|
|
|
29
26
|
|
|
30
27
|
var VideoBanner = function VideoBanner(_ref) {
|
|
31
28
|
var video = _ref.video,
|
|
32
|
-
poster = _ref.poster
|
|
29
|
+
poster = _ref.poster,
|
|
30
|
+
controls = _ref.controls,
|
|
31
|
+
autoPlay = _ref.autoPlay,
|
|
32
|
+
loop = _ref.loop,
|
|
33
|
+
muted = _ref.muted,
|
|
34
|
+
showPosterAfterPlaying = _ref.showPosterAfterPlaying;
|
|
33
35
|
var videoEl = (0, _react.useRef)(null);
|
|
34
36
|
|
|
35
|
-
var
|
|
37
|
+
var triggerPlay = function triggerPlay() {
|
|
36
38
|
videoEl.current.play();
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
(0, _react.useEffect)(function () {
|
|
40
|
-
|
|
42
|
+
// Trigger onload autoplay based on prop:
|
|
43
|
+
if (autoPlay) {
|
|
44
|
+
triggerPlay();
|
|
45
|
+
} // And attach event listener based on prop:
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if (!loop && showPosterAfterPlaying) {
|
|
49
|
+
videoEl.current.addEventListener('ended', function () {
|
|
50
|
+
// Reloads video, which re-shows poster
|
|
51
|
+
videoEl.current.load();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
41
54
|
});
|
|
42
55
|
return /*#__PURE__*/_react.default.createElement(Video, {
|
|
43
56
|
poster: poster,
|
|
44
57
|
src: video,
|
|
45
|
-
ref: videoEl
|
|
58
|
+
ref: videoEl,
|
|
59
|
+
controls: controls,
|
|
60
|
+
loop: loop,
|
|
61
|
+
muted: muted
|
|
46
62
|
}, "Your browser does not support video.");
|
|
47
63
|
};
|
|
48
64
|
|
|
65
|
+
VideoBanner.defaultProps = {
|
|
66
|
+
showPosterAfterPlaying: true,
|
|
67
|
+
controls: false,
|
|
68
|
+
autoPlay: true,
|
|
69
|
+
loop: false,
|
|
70
|
+
muted: true
|
|
71
|
+
};
|
|
49
72
|
var _default = VideoBanner;
|
|
50
73
|
exports.default = _default;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
+
Default Video Banner (autoplay, no loop, no poster re-show)
|
|
1
2
|
```js
|
|
2
|
-
import poster from '../../../styleguide/assets/
|
|
3
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
3
4
|
const src =
|
|
4
5
|
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
5
6
|
|
|
6
7
|
<VideoBanner poster={poster} video={src} />;
|
|
7
8
|
```
|
|
9
|
+
Looping Video Banner With Controls (autoplay, loop)
|
|
10
|
+
```js
|
|
11
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
12
|
+
const src =
|
|
13
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
14
|
+
|
|
15
|
+
<VideoBanner poster={poster} video={src} loop={true} controls={true} autoPlay={true}
|
|
16
|
+
/>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Non-autoplay Video Banner (reshows poster image after playing)
|
|
20
|
+
```js
|
|
21
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
22
|
+
const src =
|
|
23
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
24
|
+
|
|
25
|
+
<VideoBanner poster={poster} video={src} showPosterAfterPlaying={true} />;
|
|
26
|
+
```
|
|
@@ -10,13 +10,13 @@ var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWith
|
|
|
10
10
|
|
|
11
11
|
var _VideoBanner = _interopRequireDefault(require("./VideoBanner"));
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _VideoBannerPosterImage = _interopRequireDefault(require("../../../styleguide/assets/VideoBannerPosterImage.png"));
|
|
14
14
|
|
|
15
|
-
it(
|
|
16
|
-
var src =
|
|
15
|
+
it("renders correctly", function () {
|
|
16
|
+
var src = "https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4";
|
|
17
17
|
var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_VideoBanner.default, {
|
|
18
|
-
poster:
|
|
18
|
+
poster: _VideoBannerPosterImage.default,
|
|
19
19
|
video: src
|
|
20
20
|
})).toJSON();
|
|
21
|
-
expect(tree).toMatchInlineSnapshot("\n .c0 {\n width: 100%;\n height: 100%;\n }\n\n <video\n
|
|
21
|
+
expect(tree).toMatchInlineSnapshot("\n .c0 {\n width: 100%;\n height: 100%;\n }\n\n <video\n className=\"c0\"\n controls={false}\n loop={false}\n muted={true}\n playsInline={true}\n poster=\"mock.asset\"\n src=\"https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4\"\n >\n Your browser does not support video.\n </video>\n ");
|
|
22
22
|
});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
<Select
|
|
6
6
|
label="Label"
|
|
7
7
|
description="Please choose an option"
|
|
8
|
+
// note: defaultValue is just using the built-in React defaultValue prop. It adds the HTML prop "selected" to one of the options elements. This is why defaultValue must be set to one of the existing options values:
|
|
9
|
+
defaultValue="Option four"
|
|
8
10
|
errorMsg=""
|
|
9
11
|
options={[
|
|
10
12
|
{ value: 'Option one', displayValue: 'The first option' },
|
|
11
|
-
{
|
|
12
|
-
value: 'Option two',
|
|
13
|
-
displayValue: 'The second option'
|
|
14
|
-
},
|
|
13
|
+
{ value: 'Option two', displayValue: 'The second option' },
|
|
15
14
|
{ value: 'Option three', displayValue: 'The third option' },
|
|
16
15
|
{ value: 'Option four', displayValue: 'The fourth option' }
|
|
17
16
|
]}
|
|
@@ -119,7 +119,7 @@ const CardDs = ({
|
|
|
119
119
|
tabIndex="-1"
|
|
120
120
|
href={link}
|
|
121
121
|
target={target}
|
|
122
|
-
data-cta-copy={linkLabel}
|
|
122
|
+
data-image-cta-copy={linkLabel}
|
|
123
123
|
{...rest}
|
|
124
124
|
>
|
|
125
125
|
{Media}
|
|
@@ -153,6 +153,7 @@ const CardDs = ({
|
|
|
153
153
|
target={target}
|
|
154
154
|
type="button"
|
|
155
155
|
icon={icon}
|
|
156
|
+
data-button-cta-copy={linkLabel}
|
|
156
157
|
>
|
|
157
158
|
{linkLabel}
|
|
158
159
|
</Link>
|
|
@@ -189,7 +189,7 @@ exports[`renders correctly 1`] = `
|
|
|
189
189
|
<a
|
|
190
190
|
aria-hidden="true"
|
|
191
191
|
className="c1"
|
|
192
|
-
data-cta-copy="Find out more"
|
|
192
|
+
data-image-cta-copy="Find out more"
|
|
193
193
|
href="/home"
|
|
194
194
|
tabIndex="-1"
|
|
195
195
|
target="_blank"
|
|
@@ -228,6 +228,7 @@ exports[`renders correctly 1`] = `
|
|
|
228
228
|
<a
|
|
229
229
|
className="c7"
|
|
230
230
|
color="red"
|
|
231
|
+
data-button-cta-copy="Find out more"
|
|
231
232
|
href="/home"
|
|
232
233
|
rel={null}
|
|
233
234
|
target="_self"
|
|
@@ -56,7 +56,7 @@ const SingleMessageDs = ({
|
|
|
56
56
|
tabIndex="-1"
|
|
57
57
|
href={link}
|
|
58
58
|
target={target}
|
|
59
|
-
data-cta-copy={linkLabel}
|
|
59
|
+
data-image-cta-copy={linkLabel}
|
|
60
60
|
{...rest}
|
|
61
61
|
>
|
|
62
62
|
{Media}
|
|
@@ -71,7 +71,7 @@ const SingleMessageDs = ({
|
|
|
71
71
|
tabIndex="-1"
|
|
72
72
|
href={youTubeId}
|
|
73
73
|
target={target}
|
|
74
|
-
data-cta-copy={linkLabel}
|
|
74
|
+
data-image-cta-copy={linkLabel}
|
|
75
75
|
{...rest}
|
|
76
76
|
onClick={e => { setIsOpen(true); e.preventDefault(); }}
|
|
77
77
|
>
|
|
@@ -144,6 +144,7 @@ const SingleMessageDs = ({
|
|
|
144
144
|
target={target}
|
|
145
145
|
type="button"
|
|
146
146
|
icon={icon}
|
|
147
|
+
data-button-cta-copy={linkLabel}
|
|
147
148
|
>
|
|
148
149
|
{linkLabel}
|
|
149
150
|
</Link>
|
|
@@ -234,7 +234,7 @@ exports[`renders correctly 1`] = `
|
|
|
234
234
|
<a
|
|
235
235
|
aria-hidden="true"
|
|
236
236
|
className="c1"
|
|
237
|
-
data-cta-copy="Check out the shop"
|
|
237
|
+
data-image-cta-copy="Check out the shop"
|
|
238
238
|
href="/home"
|
|
239
239
|
tabIndex="-1"
|
|
240
240
|
target="_blank"
|
|
@@ -286,6 +286,7 @@ exports[`renders correctly 1`] = `
|
|
|
286
286
|
<a
|
|
287
287
|
className="c11"
|
|
288
288
|
color="blue_dark"
|
|
289
|
+
data-button-cta-copy="Check out the shop"
|
|
289
290
|
href="/home"
|
|
290
291
|
rel={null}
|
|
291
292
|
target="_self"
|
|
@@ -3,36 +3,66 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
const Video = styled.video.attrs(() => ({
|
|
6
|
-
|
|
7
|
-
playsInline: true,
|
|
8
|
-
muted: true,
|
|
9
|
-
loop: false
|
|
6
|
+
playsInline: true
|
|
10
7
|
}))`
|
|
11
8
|
width: 100%;
|
|
12
9
|
height: 100%;
|
|
13
10
|
`;
|
|
14
11
|
|
|
15
|
-
const VideoBanner = ({
|
|
12
|
+
const VideoBanner = ({
|
|
13
|
+
video, poster, controls, autoPlay, loop, muted, showPosterAfterPlaying
|
|
14
|
+
}) => {
|
|
16
15
|
const videoEl = useRef(null);
|
|
17
16
|
|
|
18
|
-
const
|
|
17
|
+
const triggerPlay = () => {
|
|
19
18
|
videoEl.current.play();
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
useEffect(() => {
|
|
23
|
-
|
|
22
|
+
// Trigger onload autoplay based on prop:
|
|
23
|
+
if (autoPlay) {
|
|
24
|
+
triggerPlay();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// And attach event listener based on prop:
|
|
28
|
+
if (!loop && showPosterAfterPlaying) {
|
|
29
|
+
videoEl.current.addEventListener('ended', () => {
|
|
30
|
+
// Reloads video, which re-shows poster
|
|
31
|
+
videoEl.current.load();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
24
34
|
});
|
|
25
35
|
|
|
26
36
|
return (
|
|
27
|
-
<Video
|
|
37
|
+
<Video
|
|
38
|
+
poster={poster}
|
|
39
|
+
src={video}
|
|
40
|
+
ref={videoEl}
|
|
41
|
+
controls={controls}
|
|
42
|
+
loop={loop}
|
|
43
|
+
muted={muted}
|
|
44
|
+
>
|
|
28
45
|
Your browser does not support video.
|
|
29
46
|
</Video>
|
|
30
47
|
);
|
|
31
48
|
};
|
|
32
49
|
|
|
50
|
+
VideoBanner.defaultProps = {
|
|
51
|
+
showPosterAfterPlaying: true,
|
|
52
|
+
controls: false,
|
|
53
|
+
autoPlay: true,
|
|
54
|
+
loop: false,
|
|
55
|
+
muted: true
|
|
56
|
+
};
|
|
57
|
+
|
|
33
58
|
VideoBanner.propTypes = {
|
|
59
|
+
showPosterAfterPlaying: PropTypes.bool,
|
|
34
60
|
video: PropTypes.string.isRequired,
|
|
35
|
-
poster: PropTypes.string.isRequired
|
|
61
|
+
poster: PropTypes.string.isRequired,
|
|
62
|
+
controls: PropTypes.bool,
|
|
63
|
+
autoPlay: PropTypes.bool,
|
|
64
|
+
loop: PropTypes.bool,
|
|
65
|
+
muted: PropTypes.bool
|
|
36
66
|
};
|
|
37
67
|
|
|
38
68
|
export default VideoBanner;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
+
Default Video Banner (autoplay, no loop, no poster re-show)
|
|
1
2
|
```js
|
|
2
|
-
import poster from '../../../styleguide/assets/
|
|
3
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
3
4
|
const src =
|
|
4
5
|
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
5
6
|
|
|
6
7
|
<VideoBanner poster={poster} video={src} />;
|
|
7
8
|
```
|
|
9
|
+
Looping Video Banner With Controls (autoplay, loop)
|
|
10
|
+
```js
|
|
11
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
12
|
+
const src =
|
|
13
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
14
|
+
|
|
15
|
+
<VideoBanner poster={poster} video={src} loop={true} controls={true} autoPlay={true}
|
|
16
|
+
/>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Non-autoplay Video Banner (reshows poster image after playing)
|
|
20
|
+
```js
|
|
21
|
+
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
|
|
22
|
+
const src =
|
|
23
|
+
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
|
|
24
|
+
|
|
25
|
+
<VideoBanner poster={poster} video={src} showPosterAfterPlaying={true} />;
|
|
26
|
+
```
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "jest-styled-components";
|
|
3
3
|
|
|
4
|
-
import renderWithTheme from
|
|
5
|
-
import VideoBanner from
|
|
6
|
-
import poster from
|
|
4
|
+
import renderWithTheme from "../../../hoc/shallowWithTheme";
|
|
5
|
+
import VideoBanner from "./VideoBanner";
|
|
6
|
+
import poster from "../../../styleguide/assets/VideoBannerPosterImage.png";
|
|
7
7
|
|
|
8
|
-
it(
|
|
9
|
-
const src =
|
|
8
|
+
it("renders correctly", () => {
|
|
9
|
+
const src =
|
|
10
|
+
"https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4";
|
|
10
11
|
|
|
11
12
|
const tree = renderWithTheme(
|
|
12
13
|
<VideoBanner poster={poster} video={src} />
|
|
@@ -19,8 +20,8 @@ it('renders correctly', () => {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
<video
|
|
22
|
-
autoPlay={true}
|
|
23
23
|
className="c0"
|
|
24
|
+
controls={false}
|
|
24
25
|
loop={false}
|
|
25
26
|
muted={true}
|
|
26
27
|
playsInline={true}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|