Skip to content

Commit 8616c02

Browse files
Update Labs immersive main media and typography (#16707)
* Update Labs immersive main media and typography * Fixed height below desktop only * Set 469px as minimum height not fixed * Update StandardLayoutArticleGrid.tsx * Remove font weight override
1 parent 7120f05 commit 8616c02

1 file changed

Lines changed: 36 additions & 9 deletions

File tree

dotcom-rendering/src/layouts/StandardLayoutArticleGrid.tsx

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const stretchLines = css`
6161
const immersiveMediaBelowDesktop = (
6262
headlineBackground: string,
6363
isMainMediaImage: boolean,
64+
hasMinimumImageHeight: boolean,
6465
) => css`
6566
${until.desktop} {
6667
position: relative;
@@ -78,18 +79,24 @@ const immersiveMediaBelowDesktop = (
7879
position: absolute;
7980
left: 0;
8081
right: 0;
81-
bottom: 0;
82-
height: ${isMainMediaImage
83-
? 'min(60%, calc(200% - 120vw + 30px))'
84-
: 'min(60%, 144px)'};
82+
bottom: ${hasMinimumImageHeight ? '-1px' : '0'};
83+
height: ${hasMinimumImageHeight
84+
? '180px'
85+
: isMainMediaImage
86+
? 'min(60%, calc(200% - 120vw + 30px))'
87+
: 'min(60%, 144px)'};
8588
z-index: ${getZIndex('mediaOverlay')};
8689
background: linear-gradient(
8790
to bottom,
88-
rgba(0, 0, 0, 0.08),
89-
${headlineBackground} 72%
91+
rgba(0, 0, 0, ${hasMinimumImageHeight ? '0' : '0.08'}),
92+
${headlineBackground} ${hasMinimumImageHeight ? '100%' : '72%'}
9093
);
9194
backdrop-filter: blur(12px);
92-
mask-image: linear-gradient(to bottom, transparent 40%, black 60%);
95+
mask-image: linear-gradient(
96+
to bottom,
97+
transparent ${hasMinimumImageHeight ? '0%' : '40%'},
98+
black 60%
99+
);
93100
pointer-events: none;
94101
}
95102
}
@@ -185,6 +192,7 @@ export const StandardLayoutArticleGrid = ({
185192
const isMainMediaImage =
186193
mainMedia?._type ===
187194
'model.dotcomrendering.pageElements.ImageBlockElement';
195+
const hasMinimumImageHeight = isLabs && isImmersive && isMainMediaImage;
188196
const mainMediaUrl: string | undefined = isMainMediaImage
189197
? mainMedia.media.allImages[0]?.url
190198
: undefined;
@@ -197,7 +205,7 @@ export const StandardLayoutArticleGrid = ({
197205
const immersiveHeaderHeight =
198206
minHeaderHeightPx + (isLabs ? LABS_HEADER_HEIGHT : 0);
199207
const immersiveMediaRowHeight = isMainMediaImage
200-
? '60vw'
208+
? 'auto'
201209
: `max(calc(80vh - ${immersiveHeaderHeight}px), calc(25rem - ${immersiveHeaderHeight}px))`;
202210

203211
const layoutType = getLayoutType({
@@ -233,7 +241,6 @@ export const StandardLayoutArticleGrid = ({
233241
)};
234242
}
235243
}
236-
/* Anchor the title consistently while wrapped text extends the media below it. */
237244
grid-template-rows: ${immersiveMediaRowHeight} repeat(
238245
6,
239246
auto
@@ -279,7 +286,27 @@ export const StandardLayoutArticleGrid = ({
279286
${immersiveMediaBelowDesktop(
280287
headlineBackgroundImmersive,
281288
isMainMediaImage,
289+
hasMinimumImageHeight,
282290
)}
291+
292+
${hasMinimumImageHeight &&
293+
css`
294+
${until.desktop} {
295+
position: relative;
296+
width: 100%;
297+
min-width: 0;
298+
min-height: 469px;
299+
${mainMediaAspectRatio != null &&
300+
`aspect-ratio: ${mainMediaAspectRatio.replace(':', ' / ')};`}
301+
overflow: hidden;
302+
background-color: ${headlineBackgroundImmersive};
303+
304+
> div {
305+
position: absolute;
306+
inset: 0;
307+
}
308+
}
309+
`}
283310
`
284311
: undefined
285312
}

0 commit comments

Comments
 (0)