diff --git a/dotcom-rendering/src/components/Card/Card.tsx b/dotcom-rendering/src/components/Card/Card.tsx index 8fc2bb6b977..e91d41f2bb7 100644 --- a/dotcom-rendering/src/components/Card/Card.tsx +++ b/dotcom-rendering/src/components/Card/Card.tsx @@ -96,7 +96,8 @@ export type Props = { avatarUrl?: string; showClock?: boolean; mainMedia?: MainMedia; - /** Note YouTube recommends a minimum width of 480px @see https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-youtube-player-size + /** + * Note YouTube recommends a minimum width of 480px @see https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-youtube-player-size * At 300px or below, the player will begin to lose functionality e.g. volume controls being omitted. * Youtube requires a minimum width 200px. */ @@ -133,8 +134,14 @@ export type Props = { isTagPage?: boolean; /** Allows the consumer to set an aspect ratio on the image of 5:3, 5:4, 4:5 or 1:1 */ aspectRatio?: AspectRatio; + /** The index of the card in a carousel */ index?: number; - /** The Splash card in a flexible container gets a different visual treatment to other cards*/ + /** + * Useful for videos. Has the form: collection-{collection ID}-{card grouping type}-{card index} + * For example, the first splash card in the second collection would be: "collection-1-splash-0" + */ + uniqueId?: string; + /** The Splash card in a flexible container gets a different visual treatment to other cards */ isFlexSplash?: boolean; showTopBarDesktop?: boolean; showTopBarMobile?: boolean; @@ -402,6 +409,7 @@ export const Card = ({ isTagPage = false, aspectRatio, index = 0, + uniqueId = '', isFlexSplash, showTopBarDesktop = true, showTopBarMobile = true, @@ -896,7 +904,6 @@ export const Card = ({ src={media.mainMedia.videoId} height={media.mainMedia.height} width={media.mainMedia.width} - videoId={media.mainMedia.videoId} thumbnailImage={ media.mainMedia.thumbnailImage ?? '' } @@ -909,6 +916,7 @@ export const Card = ({ aspectRatio={aspectRatio} /> } + uniqueId={uniqueId} /> )} diff --git a/dotcom-rendering/src/components/DecideContainer.tsx b/dotcom-rendering/src/components/DecideContainer.tsx index 85e33692f1b..04bb36f3d0f 100644 --- a/dotcom-rendering/src/components/DecideContainer.tsx +++ b/dotcom-rendering/src/components/DecideContainer.tsx @@ -64,7 +64,6 @@ export const DecideContainer = ({ collectionId, containerLevel, }: Props) => { - // If you add a new container type which contains an MPU, you must also add it to switch (containerType) { case 'dynamic/fast': return ( @@ -255,6 +254,7 @@ export const DecideContainer = ({ absoluteServerTimes={absoluteServerTimes} imageLoading={imageLoading} aspectRatio={aspectRatio} + collectionId={collectionId} /> ); case 'flexible/general': diff --git a/dotcom-rendering/src/components/FlexibleGeneral.tsx b/dotcom-rendering/src/components/FlexibleGeneral.tsx index 0726ff34b5b..c6f5072ff7b 100644 --- a/dotcom-rendering/src/components/FlexibleGeneral.tsx +++ b/dotcom-rendering/src/components/FlexibleGeneral.tsx @@ -80,6 +80,14 @@ export const decideCardPositions = (cards: DCRFrontCard[]): GroupedCards => { }, []); }; +type ImmersiveCardLayoutProps = { + card: DCRFrontCard; + containerPalette?: DCRContainerPalette; + absoluteServerTimes: boolean; + imageLoading: Loading; + collectionId: number; +}; + /** * ImmersiveCardLayout is a special case of the card layout that is used for cards with the isImmersive property. * It is a single feature card that takes up the full width of the container on all breakpoints. @@ -92,17 +100,11 @@ const ImmersiveCardLayout = ({ absoluteServerTimes, imageLoading, collectionId, -}: { - card: DCRFrontCard; - containerPalette?: DCRContainerPalette; - absoluteServerTimes: boolean; - imageLoading: Loading; - collectionId: number; -}) => { +}: ImmersiveCardLayoutProps) => { const isLoopingVideo = card.mainMedia?.type === 'LoopVideo'; return ( -