Skip to content
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
3 changes: 3 additions & 0 deletions dotcom-rendering/src/components/MainMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type Props = {
editionId: EditionId;
shouldHideAds: boolean;
contentType?: string;
contentLayout?: string;
};

export const MainMedia = ({
Expand All @@ -107,6 +108,7 @@ export const MainMedia = ({
editionId,
shouldHideAds,
contentType,
contentLayout,
}: Props) => {
return (
<div css={[mainMedia, chooseWrapper(format)]}>
Expand All @@ -131,6 +133,7 @@ export const MainMedia = ({
editionId={editionId}
shouldHideAds={shouldHideAds}
contentType={contentType}
contentLayout={contentLayout}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Props = {
byline?: string;
showByline?: boolean;
contentType?: string;
contentLayout?: string;
};

export const YoutubeBlockComponent = ({
Expand Down Expand Up @@ -95,6 +96,7 @@ export const YoutubeBlockComponent = ({
byline,
showByline,
contentType,
contentLayout,
}: Props) => {
const [consentState, setConsentState] = useState<ConsentState | undefined>(
undefined,
Expand All @@ -113,13 +115,22 @@ export const YoutubeBlockComponent = ({
*/
const uniqueId = `${assetId}-${index}`;

// We need Video articles generated directly from Media Atom Maker
// to always show their poster (16:9) image, but in other cases
// use the override image (often supplied as 5:4 then cropped to 16:9)
const getPosterImage = () => {
// We need Video articles generated directly from Media Atom Maker
// to always show their poster (16:9) image, but in other cases
// use the override image (often supplied as 5:4 then cropped to 16:9)
if (contentType && contentType.toLowerCase() === 'video') {
return posterImage;
}

// For Standard Articles with a Video atom for their main media
// we need to display the poster image
if (contentLayout && contentLayout.toLowerCase() === 'standardlayout') {
return posterImage;
}

// Default behaviour is to use the override image, if supplied
// otherwise use the poster image
return overrideImage ?? posterImage;
};

Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/layouts/StandardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ export const StandardLayout = (props: WebProps | AppProps) => {
hideCaption={isMedia}
shouldHideAds={article.shouldHideAds}
contentType={article.contentType}
contentLayout="StandardLayout"
/>
</div>
</GridItem>
Expand Down
5 changes: 5 additions & 0 deletions dotcom-rendering/src/lib/renderElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type Props = {
isSectionedMiniProfilesArticle?: boolean;
shouldHideAds: boolean;
contentType?: string;
contentLayout?: string;
};

// updateRole modifies the role of an element in a way appropriate for most
Expand Down Expand Up @@ -159,6 +160,7 @@ export const renderElement = ({
isSectionedMiniProfilesArticle = false,
shouldHideAds,
contentType,
contentLayout,
}: Props) => {
const isBlog =
format.design === ArticleDesign.LiveBlog ||
Expand Down Expand Up @@ -888,6 +890,7 @@ export const renderElement = ({
iconSizeOnMobile="large"
hidePillOnMobile={false}
contentType={contentType}
contentLayout={contentLayout}
/>
</Island>
);
Expand Down Expand Up @@ -956,6 +959,7 @@ export const RenderArticleElement = ({
isSectionedMiniProfilesArticle,
shouldHideAds,
contentType,
contentLayout,
}: Props) => {
const withUpdatedRole = updateRole(element, format);

Expand Down Expand Up @@ -983,6 +987,7 @@ export const RenderArticleElement = ({
isSectionedMiniProfilesArticle,
shouldHideAds,
contentType,
contentLayout,
});

const needsFigure = !bareElements.has(element._type);
Expand Down