Skip to content

Commit f10369e

Browse files
Feature specific styling
1 parent 3ac3202 commit f10369e

5 files changed

Lines changed: 59 additions & 7 deletions

File tree

dotcom-rendering/src/components/ArticleHeadline.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type Props = {
4444
hasAvatar?: boolean;
4545
isMatch?: boolean;
4646
starRating?: Rating;
47-
isInverted?: boolean;
4847
};
4948

5049
const topPadding = css`
@@ -390,8 +389,10 @@ export const ArticleHeadline = ({
390389
hasAvatar,
391390
isMatch,
392391
starRating,
393-
isInverted = false,
394392
}: Props) => {
393+
const isInverted =
394+
format.design === ArticleDesign.Standard &&
395+
format.display === ArticleDisplay.Immersive;
395396
switch (format.display) {
396397
case ArticleDisplay.Immersive: {
397398
switch (format.design) {

dotcom-rendering/src/components/Figure.tsx

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import { css } from '@emotion/react';
2-
import { breakpoints, from, space, until } from '@guardian/source/foundations';
3-
import { ArticleDesign, type ArticleFormat } from '../lib/articleFormat';
2+
import {
3+
breakpoints,
4+
from,
5+
palette as sourcePalette,
6+
space,
7+
until,
8+
} from '@guardian/source/foundations';
9+
import {
10+
ArticleDesign,
11+
ArticleDisplay,
12+
type ArticleFormat,
13+
} from '../lib/articleFormat';
14+
import { transparentColour } from '../lib/transparentColour';
15+
import { palette } from '../palette';
416
import type { FEElement, RoleType } from '../types/content';
517

618
type Props = {
@@ -14,6 +26,32 @@ type Props = {
1426
isTimeline?: boolean;
1527
};
1628

29+
const overlayMaskGradientStyles = (angle: string) => css`
30+
mask-image: linear-gradient(
31+
${angle},
32+
rgb(0, 0, 0) 0%,
33+
rgba(0, 0, 0, 0.9619) 12.5%,
34+
rgba(0, 0, 0, 0.8536) 25%,
35+
rgba(0, 0, 0, 0.6913) 37.5%,
36+
rgba(0, 0, 0, 0.5) 50%,
37+
rgba(0, 0, 0, 0.3087) 62.5%,
38+
rgba(0, 0, 0, 0.1464) 75%,
39+
rgba(0, 0, 0, 0.0381) 87.5%,
40+
transparent 100%
41+
);
42+
`;
43+
44+
const blurStyles = css`
45+
position: absolute;
46+
inset: 0;
47+
background-color: ${palette('--article-background')};
48+
backdrop-filter: blur(12px) brightness(0.5);
49+
@supports not (backdrop-filter: blur(12px)) {
50+
background-color: ${transparentColour(sourcePalette.neutral[10], 0.7)};
51+
}
52+
${overlayMaskGradientStyles('0deg')};
53+
`;
54+
1755
const roleCss = {
1856
inline: css`
1957
margin-top: ${space[3]}px;
@@ -273,6 +311,17 @@ export const Figure = ({
273311
return (
274312
<figure id={id} key={id} css={mainMediaFigureStyles}>
275313
{children}
314+
{format.display === ArticleDisplay.Immersive && (
315+
<div
316+
css={[
317+
blurStyles,
318+
css`
319+
height: 40%;
320+
top: 60%;
321+
`,
322+
]}
323+
/>
324+
)}
276325
</figure>
277326
);
278327
}

dotcom-rendering/src/components/MainMedia.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { ServerSideTests, Switches } from '../types/config';
1212
import type { FEElement } from '../types/content';
1313

1414
const mainMedia = css`
15+
position: relative;
1516
height: 100%;
1617
1718
${until.tablet} {

dotcom-rendering/src/grid.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const outerRules = (color?: string): string => `
159159
&::before {
160160
grid-column: centre-column-start;
161161
transform: translateX(-${columnGap});
162+
z-index: 10;
162163
163164
${fromBreakpoint.leftCol} {
164165
grid-column: left-column-start;
@@ -169,6 +170,7 @@ const outerRules = (color?: string): string => `
169170
&::after {
170171
grid-column: right-column-end;
171172
transform: translateX(-1px);
173+
z-index: 10;
172174
173175
${betweenBreakpoint.tablet.and.desktop} {
174176
grid-column: centre-column-end;

dotcom-rendering/src/layouts/StandardLayout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export const StandardLayout = (props: WebProps | AppProps) => {
282282
<AdSlot position="survey" display={format.display} />
283283
)}
284284

285-
<main data-layout="StandardLayout">
285+
<main data-layout={`${ArticleDisplay[format.display]}Layout`}>
286286
{isApps && renderAds && (
287287
<Island priority="critical">
288288
<AdPortals />
@@ -356,7 +356,7 @@ export const StandardLayout = (props: WebProps | AppProps) => {
356356
hideCaption={isMedia}
357357
shouldHideAds={article.shouldHideAds}
358358
contentType={article.contentType}
359-
contentLayout="StandardLayout"
359+
contentLayout={`${ArticleDisplay[format.display]}Layout`}
360360
/>
361361
</GridItem>
362362
<GridItem
@@ -407,7 +407,6 @@ export const StandardLayout = (props: WebProps | AppProps) => {
407407
article.webPublicationDateDeprecated
408408
}
409409
starRating={article.starRating}
410-
isInverted={layoutType === 'immersiveLandscape'}
411410
/>
412411
</GridItem>
413412
<GridItem area="standfirst" layoutType={layoutType}>

0 commit comments

Comments
 (0)