Skip to content

Commit d411e96

Browse files
committed
Merge branch 'main' into rjr-fix-poster-image-on-video-articles-attempt-4
2 parents 3e63ed5 + 62823b6 commit d411e96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+825
-448
lines changed

apps-rendering/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
4. Install dependencies:
99

1010
```sh
11-
pnpm
11+
pnpm install
1212
```
1313

1414
### Run (Development)

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"@guardian/shimport": "1.0.2",
4444
"@guardian/source": "9.0.0",
4545
"@guardian/source-development-kitchen": "18.1.1",
46-
"@guardian/support-dotcom-components": "7.5.0",
46+
"@guardian/support-dotcom-components": "7.6.2",
4747
"@guardian/tsconfig": "0.2.0",
4848
"@playwright/test": "1.52.0",
4949
"@sentry/browser": "7.75.1",

dotcom-rendering/src/components/ArticleHeadline.tsx

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { css } from '@emotion/react';
22
import {
3+
between,
34
from,
45
headlineBold28,
56
headlineBold34,
@@ -116,13 +117,24 @@ const decideMobileHeadlineFont = (format: ArticleFormat) => {
116117
}
117118
};
118119

119-
const headlineFont = (format: ArticleFormat) => css`
120-
${decideMobileHeadlineFont(format)}
120+
const headlineFont = (format: ArticleFormat) => {
121+
if (format.design === ArticleDesign.Gallery) {
122+
return css`
123+
${decideMobileHeadlineFont(format)}
121124
122-
${from.tablet} {
123-
${decideHeadlineFont(format)}
125+
${from.desktop} {
126+
${decideHeadlineFont(format)}
127+
}
128+
`;
124129
}
125-
`;
130+
return css`
131+
${decideMobileHeadlineFont(format)}
132+
133+
${from.tablet} {
134+
${decideHeadlineFont(format)}
135+
}
136+
`;
137+
};
126138

127139
const invertedFontLineHeight = css`
128140
line-height: 2.1875rem;
@@ -371,6 +383,17 @@ const decideBottomPadding = ({
371383
}
372384
};
373385

386+
const galleryStyles = css`
387+
${grid.between('grid-start', 'centre-column-end')}
388+
389+
grid-row: 7/9;
390+
391+
${from.tablet} {
392+
${grid.between('centre-column-start', 'grid-end')};
393+
margin-left: -10px;
394+
}
395+
`;
396+
374397
export const ArticleHeadline = ({
375398
headlineString,
376399
format,
@@ -825,15 +848,7 @@ export const ArticleHeadline = ({
825848
);
826849
case ArticleDesign.Gallery: {
827850
return (
828-
<div
829-
css={[
830-
darkBackground,
831-
grid.between('centre-column-start', 'grid-end'),
832-
css`
833-
grid-row: 7/9;
834-
`,
835-
]}
836-
>
851+
<div css={galleryStyles}>
837852
<WithAgeWarning
838853
tags={tags}
839854
webPublicationDateDeprecated={
@@ -850,9 +865,16 @@ export const ArticleHeadline = ({
850865
color: ${themePalette(
851866
'--headline-colour',
852867
)};
868+
${darkBackground};
869+
min-height: 84px;
853870
padding-bottom: ${space[6]}px;
854871
padding-left: ${space[3]}px;
855872
padding-right: ${space[3]}px;
873+
874+
${between.mobileLandscape.and
875+
.tablet} {
876+
padding-left: ${space[5]}px;
877+
}
856878
`,
857879
]}
858880
>

dotcom-rendering/src/components/ArticleMeta.apps.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,23 @@ const stretchLines = css`
201201
grid-column: 1 / -1;
202202
`;
203203

204+
const galleryMetaContainer = css`
205+
${grid.column.centre}
206+
padding-bottom: ${space[2]}px;
207+
${from.tablet} {
208+
position: relative;
209+
&::before {
210+
content: '';
211+
position: absolute;
212+
left: -10px;
213+
top: 0;
214+
bottom: 0;
215+
width: 1px;
216+
background-color: ${themePalette('--article-border')};
217+
}
218+
}
219+
`;
220+
204221
export const ArticleMetaApps = ({
205222
branding,
206223
format,
@@ -244,13 +261,7 @@ export const ArticleMetaApps = ({
244261
}
245262
css={[
246263
metaContainerMargins,
247-
isGallery ? grid.column.centre : undefined,
248-
isGallery
249-
? {
250-
marginLeft: space[3],
251-
paddingBottom: space[2],
252-
}
253-
: undefined,
264+
isGallery ? galleryMetaContainer : undefined,
254265
]}
255266
>
256267
<div

dotcom-rendering/src/components/ArticleMeta.web.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,21 @@ export const metaContainer = (format: ArticleFormat) => {
190190
case ArticleDesign.Gallery:
191191
return css`
192192
${grid.column.centre}
193-
margin-bottom: ${space[3]}px;
194-
margin-left: ${space[3]}px;
195-
margin-right: ${space[3]}px;
193+
padding-bottom: ${space[3]}px;
194+
${from.tablet} {
195+
position: relative;
196+
&::before {
197+
content: '';
198+
position: absolute;
199+
left: -10px;
200+
top: 0;
201+
bottom: 0;
202+
width: 1px;
203+
background-color: ${themePalette(
204+
'--article-border',
205+
)};
206+
}
207+
}
196208
`;
197209
default:
198210
return defaultMargins;

dotcom-rendering/src/components/ArticlePage.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,13 @@ export const ArticlePage = (props: WebProps | AppProps) => {
177177
)}
178178
{renderingTarget === 'Apps' ? (
179179
<DecideLayout
180-
article={frontendData}
181-
format={format}
180+
article={props.article}
182181
renderingTarget={renderingTarget}
183182
/>
184183
) : (
185184
<DecideLayout
186-
article={frontendData}
185+
article={props.article}
187186
NAV={props.NAV}
188-
format={format}
189187
renderingTarget={renderingTarget}
190188
/>
191189
)}

dotcom-rendering/src/components/ArticleTitle.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,16 @@ const immersiveMargins = css`
4343
`;
4444

4545
const galleryStyles = css`
46-
${grid.between('centre-column-start', 'grid-end')};
46+
${grid.column.all}
47+
4748
grid-row: 6/7;
4849
max-width: 400px;
4950
min-width: 200px;
51+
52+
${from.tablet} {
53+
${grid.between('centre-column-start', 'grid-end')};
54+
margin-left: -10px;
55+
}
5056
`;
5157

5258
export const ArticleTitle = ({

dotcom-rendering/src/components/FrontSection.tsx

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,40 @@ type Props = {
9898
const width = (columns: number, columnWidth: number, columnGap: number) =>
9999
`width: ${columns * columnWidth + (columns - 1) * columnGap}px;`;
100100

101+
const borderColourStyles = (title?: string): string => {
102+
switch (title) {
103+
case 'News':
104+
return schemePalette('--section-border-news');
105+
case 'Opinion':
106+
return schemePalette('--section-border-opinion');
107+
case 'Sport':
108+
return schemePalette('--section-border-sport');
109+
case 'Lifestyle':
110+
return schemePalette('--section-border-lifestyle');
111+
case 'Culture':
112+
return schemePalette('--section-border-culture');
113+
default:
114+
return schemePalette('--section-border-primary');
115+
}
116+
};
117+
118+
const articleSectionTitleStyles = (title?: string): string => {
119+
switch (title) {
120+
case 'News':
121+
return schemePalette('--article-section-title-news');
122+
case 'Opinion':
123+
return schemePalette('--article-section-title-opinion');
124+
case 'Sport':
125+
return schemePalette('--article-section-title-sport');
126+
case 'Lifestyle':
127+
return schemePalette('--article-section-title-lifestyle');
128+
case 'Culture':
129+
return schemePalette('--article-section-title-culture');
130+
default:
131+
return schemePalette('--article-section-title');
132+
}
133+
};
134+
101135
/** Not all browsers support CSS grid, so we set explicit width as a fallback */
102136
const fallbackStyles = css`
103137
@supports not (display: grid) {
@@ -401,10 +435,10 @@ const bottomPaddingBetaContainer = (
401435
}
402436
`;
403437

404-
const primaryLevelTopBorder = css`
438+
const primaryLevelTopBorder = (title?: string) => css`
405439
grid-row: 1;
406440
grid-column: 1 / -1;
407-
border-top: 2px solid ${schemePalette('--section-border-primary')};
441+
border-top: 2px solid ${borderColourStyles(title)};
408442
/** Ensures the top border sits above the side borders */
409443
z-index: 1;
410444
height: fit-content;
@@ -590,7 +624,7 @@ export const FrontSection = ({
590624
css={[
591625
containerLevel === 'Secondary'
592626
? secondaryLevelTopBorder
593-
: primaryLevelTopBorder,
627+
: primaryLevelTopBorder(title),
594628
]}
595629
/>
596630
)}
@@ -629,9 +663,7 @@ export const FrontSection = ({
629663
? schemePalette(
630664
'--article-section-secondary-title',
631665
)
632-
: schemePalette(
633-
'--article-section-title',
634-
)
666+
: articleSectionTitleStyles(title)
635667
}
636668
// On paid fronts the title is not treated as a link
637669
url={!isOnPaidContentFront ? url : undefined}

dotcom-rendering/src/components/FrontsAdSlots.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export const MerchandisingSlot = ({
6464
renderAds && (
6565
<Section
6666
fullWidth={true}
67-
data-print-layout="hide"
6867
padSides={false}
6968
showTopBorder={false}
7069
showSideBorders={false}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ export const LoopVideo = ({
117117
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- In earlier versions of the HTML specification, play() didn't return a value
118118
if (startPlayPromise !== undefined) {
119119
await startPlayPromise
120+
.then(() => {
121+
// Autoplay succeeded
122+
setPlayerState('PLAYING');
123+
})
120124
.catch((error: Error) => {
121125
// Autoplay failed
122126
logAndReportError(src, error);
123127
setPosterImage(image);
124-
setShowPlayIcon(true);
125-
})
126-
.then(() => {
127-
// Autoplay succeeded
128-
setPlayerState('PLAYING');
128+
setPlayerState('PAUSED_BY_BROWSER');
129129
});
130130
}
131131
}, [src, image]);

0 commit comments

Comments
 (0)