Skip to content

Commit 278545e

Browse files
authored
Merge pull request #14249 from guardian/fix-gallery-padding-and-border
fix header left padding and border
2 parents 00f5fe7 + 45b68c3 commit 278545e

File tree

7 files changed

+113
-34
lines changed

7 files changed

+113
-34
lines changed

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/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/SeriesSectionLink.tsx

Lines changed: 5 additions & 0 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
headlineBold17,
56
headlineBold20,
@@ -169,6 +170,10 @@ const sectionPadding = (design: ArticleDesign) => {
169170
if (design === ArticleDesign.Gallery) {
170171
return css`
171172
padding: 0 ${space[2]}px 0 ${space[3]}px;
173+
174+
${between.mobileLandscape.and.tablet} {
175+
padding-left: ${space[5]}px;
176+
}
172177
`;
173178
}
174179
return css`

dotcom-rendering/src/components/Standfirst.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,24 @@ const standfirstStyles = ({ display, design, theme }: ArticleFormat) => {
324324
325325
${from.tablet} {
326326
${grid.span('centre-column-start', 7)}
327+
328+
position: relative;
329+
&::before {
330+
content: '';
331+
position: absolute;
332+
left: -10px;
333+
top: 0;
334+
bottom: 0;
335+
width: 1px;
336+
background-color: ${palette(
337+
'--article-border',
338+
)};
339+
}
327340
}
328341
329342
${from.desktop} {
330343
${grid.span('centre-column-start', 6)}
331344
}
332-
margin-bottom: ${space[3]}px;
333-
margin-left: ${space[3]}px;
334-
margin-right: ${space[3]}px;
335345
`;
336346
default:
337347
switch (theme) {

dotcom-rendering/src/layouts/GalleryLayout.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from '@emotion/react';
2-
import { from } from '@guardian/source/foundations';
2+
import { between, from } from '@guardian/source/foundations';
33
import { ArticleHeadline } from '../components/ArticleHeadline';
44
import { ArticleMetaApps } from '../components/ArticleMeta.apps';
55
import { ArticleMeta } from '../components/ArticleMeta.web';
@@ -39,6 +39,10 @@ const border = css({
3939
const headerStyles = css`
4040
${grid.container}
4141
background-color: ${palette('--article-inner-background')};
42+
43+
${from.tablet} {
44+
border-bottom: 1px solid ${palette('--article-border')};
45+
}
4246
`;
4347

4448
export const GalleryLayout = (props: WebProps | AppProps) => {
@@ -158,16 +162,25 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
158162
${from.leftCol} {
159163
${grid.column.left}
160164
}
165+
position: relative;
166+
${between.tablet.and.leftCol} {
167+
&::before {
168+
content: '';
169+
position: absolute;
170+
left: -10px;
171+
top: 0;
172+
bottom: 0;
173+
width: 1px;
174+
background-color: ${palette(
175+
'--article-border',
176+
)};
177+
}
178+
}
161179
`,
162180
]}
163181
>
164182
Main media caption
165183
</div>
166-
<div
167-
css={[grid.between('centre-column-start', 'grid-end')]}
168-
>
169-
Meta
170-
</div>
171184
</header>
172185
{gallery.images.map((element, idx) => (
173186
<GalleryImage

0 commit comments

Comments
 (0)