Skip to content

Commit d236a89

Browse files
authored
[GRAV-1370] [BpkOverlay] Add video overlay style (#3717)
* [GRAV-1370] Add video overlay style to BpkOverlay * [GRAV-1370] update BpkOverlay snapshot * [GRAV-1370] update video overlays * Update BpkOverlay-test.tsx.snap * Update BpkOverlay-test.tsx.snap * [GRAV-1370] update example image ratio
1 parent 4c4d660 commit d236a89

File tree

5 files changed

+103
-3
lines changed

5 files changed

+103
-3
lines changed

examples/bpk-component-overlay/examples.js

+44
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import STYLES from './examples.module.scss';
2929

3030
const IMAGE_SRC =
3131
'https://content.skyscnr.com/m/1c8c6338a92a7a94/original/matt-hardy-6ArTTluciuA-unsplash.jpg';
32+
const VIDEO_IMG_SRC =
33+
'https://content.skyscnr.com/m/2af45124245b6759/original/SOCIAL9.png';
3234

3335
const getClassName = cssModules(STYLES);
3436

@@ -198,6 +200,47 @@ const VignetteExample = () => {
198200
);
199201
};
200202

203+
const VideoOverlayExamples = () => {
204+
const overlayTypeTop = OVERLAY_TYPES.videoTop;
205+
const overlayTypeBottom = OVERLAY_TYPES.videoBottom;
206+
return (
207+
<div className={getClassName('bpk-overlay-stories')}>
208+
{[overlayTypeTop, overlayTypeBottom].map((overlayType) => (
209+
<div className={getClassName('bpk-overlay-stories__overlay-story')}>
210+
<BpkOverlay overlayType={overlayType}>
211+
<BpkImage
212+
src={VIDEO_IMG_SRC}
213+
altText="Sail boat"
214+
aspectRatio={360 / 640}
215+
/>
216+
</BpkOverlay>
217+
<div className={getClassName('bpk-overlay-stories__overlay--name')}>
218+
<BpkText textStyle={TEXT_STYLES.xl}>
219+
{OverlayName({ overlayType })}
220+
</BpkText>
221+
</div>
222+
</div>
223+
))}
224+
<div className={getClassName('bpk-overlay-stories__overlay-story')}>
225+
<BpkOverlay overlayType={overlayTypeTop}>
226+
<BpkOverlay overlayType={overlayTypeBottom}>
227+
<BpkImage
228+
src={VIDEO_IMG_SRC}
229+
altText="Sail boat"
230+
aspectRatio={360 / 640}
231+
/>
232+
</BpkOverlay>
233+
</BpkOverlay>
234+
<div className={getClassName('bpk-overlay-stories__overlay--name')}>
235+
<BpkText textStyle={TEXT_STYLES.xl}>
236+
{overlayTypeTop} & {overlayTypeBottom}
237+
</BpkText>
238+
</div>
239+
</div>
240+
</div>
241+
);
242+
};
243+
201244
const WithForegroundContentExample = () => (
202245
<BpkOverlay
203246
overlayType={OVERLAY_TYPES.solidHigh}
@@ -240,6 +283,7 @@ export {
240283
LeftExamples,
241284
RightExamples,
242285
VignetteExample,
286+
VideoOverlayExamples,
243287
WithForegroundContentExample,
244288
MixedExample,
245289
};

examples/bpk-component-overlay/stories.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
BottomExamples,
2525
LeftExamples,
2626
RightExamples,
27+
VideoOverlayExamples,
2728
VignetteExample,
2829
WithForegroundContentExample,
2930
MixedExample,
@@ -41,13 +42,14 @@ export const Bottom = BottomExamples;
4142
export const Left = LeftExamples;
4243
export const Right = RightExamples;
4344
export const Vignette = VignetteExample;
45+
export const VideoOverlays = VideoOverlayExamples;
4446

4547
export const WithForegroundContent = WithForegroundContentExample;
4648

4749
export const VisualTest = MixedExample;
4850
export const VisualTestWithZoom = {
4951
render: VisualTest,
5052
args: {
51-
zoomEnabled: true
52-
}
53-
}
53+
zoomEnabled: true,
54+
},
55+
};

packages/bpk-component-overlay/src/BpkOverlay.module.scss

+20
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,25 @@
159159
&--vignette {
160160
box-shadow: inset 0 0 50px rgba(tokens.$bpk-text-primary-day, 0.12);
161161
}
162+
163+
&--video {
164+
&-top {
165+
background: linear-gradient(
166+
180deg,
167+
rgba(tokens.$bpk-text-primary-day, 0.45) 0%,
168+
rgba(tokens.$bpk-text-primary-day, 0) 40%,
169+
rgba(tokens.$bpk-text-primary-day, 0) 100%
170+
);
171+
}
172+
173+
&-bottom {
174+
background: linear-gradient(
175+
180deg,
176+
rgba(tokens.$bpk-text-primary-day, 0) 0%,
177+
rgba(tokens.$bpk-text-primary-day, 0) 60%,
178+
rgba(tokens.$bpk-text-primary-day, 0.9) 100%
179+
);
180+
}
181+
}
162182
}
163183
}

packages/bpk-component-overlay/src/BpkOverlay.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export const OVERLAY_TYPES = {
4141
rightMedium: 'rightMedium',
4242
rightHigh: 'rightHigh',
4343
vignette: 'vignette',
44+
videoTop: 'videoTop',
45+
videoBottom: 'videoBottom',
4446
off: 'off',
4547
} as const;
4648

@@ -61,6 +63,8 @@ const overlayTypeClassSuffixes = {
6163
[OVERLAY_TYPES.rightMedium]: 'right-medium',
6264
[OVERLAY_TYPES.rightHigh]: 'right-high',
6365
[OVERLAY_TYPES.vignette]: 'vignette',
66+
[OVERLAY_TYPES.videoTop]: 'video-top',
67+
[OVERLAY_TYPES.videoBottom]: 'video-bottom',
6468
[OVERLAY_TYPES.off]: 'off',
6569
} as const;
6670

packages/bpk-component-overlay/src/__snapshots__/BpkOverlay-test.tsx.snap

+30
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,36 @@ exports[`BpkOverlay should render correctly with overlayType={topMedium} 1`] = `
274274
</DocumentFragment>
275275
`;
276276

277+
exports[`BpkOverlay should render correctly with overlayType={videoBottom} 1`] = `
278+
<DocumentFragment>
279+
<div
280+
class="bpk-overlay__wrapper"
281+
>
282+
<span>
283+
Backpack
284+
</span>
285+
<div
286+
class="bpk-overlay__overlay bpk-overlay__overlay--video-bottom"
287+
/>
288+
</div>
289+
</DocumentFragment>
290+
`;
291+
292+
exports[`BpkOverlay should render correctly with overlayType={videoTop} 1`] = `
293+
<DocumentFragment>
294+
<div
295+
class="bpk-overlay__wrapper"
296+
>
297+
<span>
298+
Backpack
299+
</span>
300+
<div
301+
class="bpk-overlay__overlay bpk-overlay__overlay--video-top"
302+
/>
303+
</div>
304+
</DocumentFragment>
305+
`;
306+
277307
exports[`BpkOverlay should render correctly with overlayType={vignette} 1`] = `
278308
<DocumentFragment>
279309
<div

0 commit comments

Comments
 (0)