Skip to content

Commit ebb5b61

Browse files
authored
Remove isVideoArticle from youtubeAtomFeatureCard as we already have access to format in this component. (#15307)
This means we can decide if its a video article within the component and reduce prop drilling
1 parent c72f040 commit ebb5b61

4 files changed

Lines changed: 2 additions & 12 deletions

File tree

dotcom-rendering/src/components/FeatureCard.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,6 @@ export const FeatureCard = ({
423423
}: Props) => {
424424
const hasSublinks = supportingContent && supportingContent.length > 0;
425425

426-
const isVideoArticle = format.design === ArticleDesign.Video;
427-
428426
/**
429427
* Determine which type of media to use for the card.
430428
* For example, a video might be available, but if we don't want to show it, use an image instead.
@@ -522,7 +520,6 @@ export const FeatureCard = ({
522520
altText={headlineText}
523521
kickerText={kickerText}
524522
trailText={trailText}
525-
isVideoArticle={isVideoArticle}
526523
hidePillOnMobile={false}
527524
iconSizeOnDesktop="large"
528525
iconSizeOnMobile="large"

dotcom-rendering/src/components/YoutubeAtom/YoutubeAtom.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export type Props = {
5353
mobileAspectRatio?: AspectRatio;
5454
trailText?: string;
5555
headlineSizes?: ResponsiveFontSize;
56-
isVideoArticle?: boolean;
5756
webPublicationDate?: string;
5857
showClock?: boolean;
5958
serverTime?: number;
@@ -109,7 +108,6 @@ export const YoutubeAtom = ({
109108
mobileAspectRatio,
110109
trailText,
111110
headlineSizes,
112-
isVideoArticle,
113111
webPublicationDate,
114112
showClock,
115113
serverTime,
@@ -259,7 +257,6 @@ export const YoutubeAtom = ({
259257
aspectRatio={aspectRatio}
260258
mobileAspectRatio={mobileAspectRatio}
261259
trailText={trailText}
262-
isVideoArticle={isVideoArticle}
263260
webPublicationDate={webPublicationDate}
264261
showClock={!!showClock}
265262
serverTime={serverTime}

dotcom-rendering/src/components/YoutubeAtom/YoutubeAtomFeatureCardOverlay.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
space,
77
} from '@guardian/source/foundations';
88
import type { ArticleFormat } from '../../lib/articleFormat';
9+
import { ArticleDesign } from '../../lib/articleFormat';
910
import { secondsToDuration } from '../../lib/formatTime';
1011
import { transparentColour } from '../../lib/transparentColour';
1112
import { palette } from '../../palette';
@@ -130,7 +131,6 @@ type Props = {
130131
aspectRatio?: AspectRatio;
131132
mobileAspectRatio?: AspectRatio;
132133
trailText?: string;
133-
isVideoArticle?: boolean;
134134
webPublicationDate?: string;
135135
showClock?: boolean;
136136
serverTime?: number;
@@ -157,7 +157,6 @@ export const YoutubeAtomFeatureCardOverlay = ({
157157
aspectRatio,
158158
mobileAspectRatio,
159159
trailText,
160-
isVideoArticle,
161160
webPublicationDate,
162161
showClock,
163162
serverTime,
@@ -170,7 +169,7 @@ export const YoutubeAtomFeatureCardOverlay = ({
170169
}: Props) => {
171170
const id = `youtube-overlay-${uniqueId}`;
172171
const hasDuration = !isUndefined(duration) && duration > 0;
173-
172+
const isVideoArticle = format.design === ArticleDesign.Video;
174173
const showCardAge =
175174
webPublicationDate !== undefined &&
176175
showClock !== undefined &&

dotcom-rendering/src/components/YoutubeBlockComponent.importable.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ type Props = {
4141
aspectRatio?: AspectRatio;
4242
trailText?: string;
4343
headlineSizes?: ResponsiveFontSize;
44-
isVideoArticle?: boolean;
4544
webPublicationDate?: string;
4645
showClock?: boolean;
4746
serverTime?: number;
@@ -84,7 +83,6 @@ export const YoutubeBlockComponent = ({
8483
aspectRatio,
8584
trailText,
8685
headlineSizes,
87-
isVideoArticle,
8886
webPublicationDate,
8987
showClock,
9088
serverTime,
@@ -216,7 +214,6 @@ export const YoutubeBlockComponent = ({
216214
mobileAspectRatio={mobileAspectRatio}
217215
trailText={trailText}
218216
headlineSizes={headlineSizes}
219-
isVideoArticle={isVideoArticle}
220217
webPublicationDate={webPublicationDate}
221218
showClock={!!showClock}
222219
serverTime={serverTime}

0 commit comments

Comments
 (0)