Skip to content

Commit a8e0a68

Browse files
committed
Disable default video in feature cards
1 parent a9e7e5f commit a8e0a68

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

dotcom-rendering/src/components/FeatureCard.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -265,26 +265,30 @@ const getMedia = ({
265265
mainMedia?: MainMedia;
266266
showVideo?: boolean;
267267
}) => {
268-
if (mainMedia?.type === 'SelfHostedVideo' && showVideo) {
269-
let type: CardMediaType;
268+
if (
269+
showVideo &&
270+
mainMedia?.type === 'SelfHostedVideo' &&
271+
(mainMedia.videoStyle === 'Loop' ||
272+
mainMedia.videoStyle === 'Cinemagraph')
273+
) {
274+
let style: CardMediaType;
270275
switch (mainMedia.videoStyle) {
271276
case 'Loop':
272-
type = 'loop-video';
277+
style = 'loop-video';
273278
break;
274279
case 'Cinemagraph':
275-
type = 'cinemagraph';
280+
style = 'cinemagraph';
276281
break;
277-
default:
278-
type = 'default-video';
279282
}
280283

281284
return {
282-
type,
285+
type: 'self-hosted-video',
286+
style,
283287
mainMedia,
284288
} as const;
285289
}
286290

287-
if (mainMedia?.type === 'YoutubeVideo' && showVideo) {
291+
if (showVideo && mainMedia?.type === 'YoutubeVideo') {
288292
return {
289293
type: 'youtube-video',
290294
mainMedia,
@@ -455,13 +459,9 @@ export const FeatureCard = ({
455459

456460
const isYoutubeVideo = media.type === 'youtube-video';
457461

458-
const isSelfHostedVideo =
459-
media.type === 'loop-video' ||
460-
media.type === 'default-video' ||
461-
media.type === 'cinemagraph';
462+
const isSelfHostedVideo = media.type === 'self-hosted-video';
462463

463-
const isSelfHostedVideoWithControls =
464-
media.type === 'loop-video' || media.type === 'default-video';
464+
const isSelfHostedVideoWithControls = media.style === 'loop-video';
465465

466466
const labsDataAttributes = branding
467467
? getOphanComponents({
@@ -476,7 +476,7 @@ export const FeatureCard = ({
476476

477477
/* The whole card is clickable on cinemagraphs and pictures */
478478
const allowLinkThroughOverlay =
479-
media.type === 'cinemagraph' || media.type === 'picture';
479+
media.style === 'cinemagraph' || media.type === 'picture';
480480

481481
return (
482482
<FormatBoundary format={format}>

0 commit comments

Comments
 (0)