Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GRAV-1370] [BpkOverlay] Add video overlay style #3717

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions examples/bpk-component-overlay/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import STYLES from './examples.module.scss';

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

const getClassName = cssModules(STYLES);

Expand Down Expand Up @@ -198,6 +200,47 @@ const VignetteExample = () => {
);
};

const VideoOverlayExamples = () => {
const overlayTypeTop = OVERLAY_TYPES.videoTop;
const overlayTypeBottom = OVERLAY_TYPES.videoBottom;
return (
<div className={getClassName('bpk-overlay-stories')}>
{[overlayTypeTop, overlayTypeBottom].map((overlayType) => (
<div className={getClassName('bpk-overlay-stories__overlay-story')}>
<BpkOverlay overlayType={overlayType}>
<BpkImage
src={VIDEO_IMG_SRC}
altText="Sail boat"
aspectRatio={360 / 640}
/>
</BpkOverlay>
<div className={getClassName('bpk-overlay-stories__overlay--name')}>
<BpkText textStyle={TEXT_STYLES.xl}>
{OverlayName({ overlayType })}
</BpkText>
</div>
</div>
))}
<div className={getClassName('bpk-overlay-stories__overlay-story')}>
<BpkOverlay overlayType={overlayTypeTop}>
<BpkOverlay overlayType={overlayTypeBottom}>
<BpkImage
src={VIDEO_IMG_SRC}
altText="Sail boat"
aspectRatio={360 / 640}
/>
</BpkOverlay>
</BpkOverlay>
<div className={getClassName('bpk-overlay-stories__overlay--name')}>
<BpkText textStyle={TEXT_STYLES.xl}>
{overlayTypeTop} & {overlayTypeBottom}
</BpkText>
</div>
</div>
</div>
);
};

const WithForegroundContentExample = () => (
<BpkOverlay
overlayType={OVERLAY_TYPES.solidHigh}
Expand Down Expand Up @@ -240,6 +283,7 @@ export {
LeftExamples,
RightExamples,
VignetteExample,
VideoOverlayExamples,
WithForegroundContentExample,
MixedExample,
};
8 changes: 5 additions & 3 deletions examples/bpk-component-overlay/stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
BottomExamples,
LeftExamples,
RightExamples,
VideoOverlayExamples,
VignetteExample,
WithForegroundContentExample,
MixedExample,
Expand All @@ -41,13 +42,14 @@ export const Bottom = BottomExamples;
export const Left = LeftExamples;
export const Right = RightExamples;
export const Vignette = VignetteExample;
export const VideoOverlays = VideoOverlayExamples;

export const WithForegroundContent = WithForegroundContentExample;

export const VisualTest = MixedExample;
export const VisualTestWithZoom = {
render: VisualTest,
args: {
zoomEnabled: true
}
}
zoomEnabled: true,
},
};
20 changes: 20 additions & 0 deletions packages/bpk-component-overlay/src/BpkOverlay.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,25 @@
&--vignette {
box-shadow: inset 0 0 50px rgba(tokens.$bpk-text-primary-day, 0.12);
}

&--video {
&-top {
background: linear-gradient(
180deg,
rgba(tokens.$bpk-text-primary-day, 0.45) 0%,
rgba(tokens.$bpk-text-primary-day, 0) 40%,
rgba(tokens.$bpk-text-primary-day, 0) 100%
);
}

&-bottom {
background: linear-gradient(
180deg,
rgba(tokens.$bpk-text-primary-day, 0) 0%,
rgba(tokens.$bpk-text-primary-day, 0) 60%,
rgba(tokens.$bpk-text-primary-day, 0.9) 100%
);
}
}
}
}
4 changes: 4 additions & 0 deletions packages/bpk-component-overlay/src/BpkOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const OVERLAY_TYPES = {
rightMedium: 'rightMedium',
rightHigh: 'rightHigh',
vignette: 'vignette',
videoTop: 'videoTop',
videoBottom: 'videoBottom',
off: 'off',
} as const;

Expand All @@ -61,6 +63,8 @@ const overlayTypeClassSuffixes = {
[OVERLAY_TYPES.rightMedium]: 'right-medium',
[OVERLAY_TYPES.rightHigh]: 'right-high',
[OVERLAY_TYPES.vignette]: 'vignette',
[OVERLAY_TYPES.videoTop]: 'video-top',
[OVERLAY_TYPES.videoBottom]: 'video-bottom',
[OVERLAY_TYPES.off]: 'off',
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,36 @@ exports[`BpkOverlay should render correctly with overlayType={topMedium} 1`] = `
</DocumentFragment>
`;

exports[`BpkOverlay should render correctly with overlayType={videoBottom} 1`] = `
<DocumentFragment>
<div
class="bpk-overlay__wrapper"
>
<span>
Backpack
</span>
<div
class="bpk-overlay__overlay bpk-overlay__overlay--video-bottom"
/>
</div>
</DocumentFragment>
`;

exports[`BpkOverlay should render correctly with overlayType={videoTop} 1`] = `
<DocumentFragment>
<div
class="bpk-overlay__wrapper"
>
<span>
Backpack
</span>
<div
class="bpk-overlay__overlay bpk-overlay__overlay--video-top"
/>
</div>
</DocumentFragment>
`;

exports[`BpkOverlay should render correctly with overlayType={vignette} 1`] = `
<DocumentFragment>
<div
Expand Down
Loading