Skip to content

Commit 04ff8d2

Browse files
marjisoundJamieB-gu
andcommitted
Add gallery sub meta
Co-authored-by: Jamie B <[email protected]>
1 parent b2c00c1 commit 04ff8d2

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

dotcom-rendering/src/components/SubMeta.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css } from '@emotion/react';
1+
import { css, type SerializedStyles } from '@emotion/react';
22
import {
33
from,
44
space,
@@ -7,13 +7,15 @@ import {
77
until,
88
} from '@guardian/source/foundations';
99
import { LinkButton } from '@guardian/source/react-components';
10+
import { grid } from '../grid';
1011
import { ArticleDesign, type ArticleFormat } from '../lib/articleFormat';
1112
import type { BaseLinkType } from '../model/extract-nav';
1213
import { palette } from '../palette';
1314
import { Island } from './Island';
1415
import { ShareButton } from './ShareButton.importable';
1516

16-
const labelStyles = css`
17+
const labelStyles = (design: ArticleDesign): SerializedStyles => css`
18+
${design === ArticleDesign.Gallery ? grid.column.centre : undefined};
1719
${textSans12};
1820
display: block;
1921
color: ${palette('--sub-meta-label-text')};
@@ -46,7 +48,7 @@ const setMetaWidth = css`
4648
}
4749
`;
4850

49-
const listStyleNone = css`
51+
const listStyles = css`
5052
list-style: none;
5153
/* https://developer.mozilla.org/en-US/docs/Web/CSS/list-style#accessibility_concerns */
5254
/* Needs double escape char: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#es2018_revision_of_illegal_escape_sequences */
@@ -79,7 +81,8 @@ const listStyleNone = css`
7981
background-repeat: no-repeat;
8082
`;
8183

82-
const listWrapper = css`
84+
const listWrapper = (design: ArticleDesign): SerializedStyles => css`
85+
${design === ArticleDesign.Gallery ? grid.column.centre : undefined};
8386
padding-bottom: 0.75rem;
8487
margin-bottom: 6px;
8588
border-bottom: 1px solid ${palette('--article-border')};
@@ -146,17 +149,23 @@ export const SubMeta = ({
146149
return (
147150
<div
148151
data-print-layout="hide"
149-
css={
152+
css={[
153+
bottomPadding,
150154
format.design === ArticleDesign.Interactive
151-
? [bottomPadding, setMetaWidth]
152-
: bottomPadding
153-
}
155+
? setMetaWidth
156+
: undefined,
157+
format.design === ArticleDesign.Gallery
158+
? grid.container
159+
: undefined,
160+
]}
154161
>
155162
{hasLinks && (
156163
<>
157-
<span css={labelStyles}>Explore more on these topics</span>
158-
<div css={listWrapper}>
159-
<ul css={listStyleNone}>
164+
<span css={labelStyles(format.design)}>
165+
Explore more on these topics
166+
</span>
167+
<div css={listWrapper(format.design)}>
168+
<ul css={listStyles}>
160169
{links.map((link) => (
161170
<li css={listItemStyles} key={link.url}>
162171
<a css={linkStyles} href={link.url}>
@@ -184,7 +193,8 @@ export const SubMeta = ({
184193
/>
185194
</Island>
186195
<div css={syndicationButtonOverrides}>
187-
{format.design === ArticleDesign.Interactive ? null : (
196+
{format.design === ArticleDesign.Interactive ||
197+
format.design === ArticleDesign.Gallery ? null : (
188198
<LinkButton
189199
priority="tertiary"
190200
size="xsmall"

dotcom-rendering/src/layouts/GalleryLayout.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ArticleTitle } from '../components/ArticleTitle';
77
import { MainMediaGallery } from '../components/MainMediaGallery';
88
import { Masthead } from '../components/Masthead/Masthead';
99
import { Standfirst } from '../components/Standfirst';
10+
import { SubMeta } from '../components/SubMeta';
1011
import { grid } from '../grid';
1112
import type { ArticleFormat } from '../lib/articleFormat';
1213
import type { NavType } from '../model/extract-nav';
@@ -167,7 +168,18 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
167168
</div>
168169
</header>
169170
<div css={border}>Body</div>
170-
<div css={border}>Submeta</div>
171+
<SubMeta
172+
format={format}
173+
subMetaKeywordLinks={frontendData.subMetaKeywordLinks}
174+
subMetaSectionLinks={frontendData.subMetaSectionLinks}
175+
pageId={frontendData.pageId}
176+
webUrl={frontendData.webURL}
177+
webTitle={frontendData.webTitle}
178+
showBottomSocialButtons={
179+
frontendData.showBottomSocialButtons &&
180+
props.renderingTarget === 'Web'
181+
}
182+
/>
171183
</main>
172184
</>
173185
);

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3731,6 +3731,8 @@ const subMetaLabelTextLight: PaletteFunction = ({ theme, design }) => {
37313731
case ArticleDesign.Video:
37323732
case ArticleDesign.Audio:
37333733
return sourcePalette.neutral[60];
3734+
case ArticleDesign.Gallery:
3735+
return sourcePalette.neutral[73];
37343736
default:
37353737
return sourcePalette.neutral[46];
37363738
}
@@ -3775,6 +3777,7 @@ const subMetaBackgroundLight: PaletteFunction = ({
37753777
case ArticleDesign.Picture:
37763778
case ArticleDesign.Video:
37773779
case ArticleDesign.Audio:
3780+
case ArticleDesign.Gallery:
37783781
switch (theme) {
37793782
case ArticleSpecial.Labs:
37803783
return sourcePalette.neutral[86];
@@ -3840,6 +3843,7 @@ const subMetaTextLight: PaletteFunction = ({ design, theme }) => {
38403843
case ArticleDesign.Picture:
38413844
case ArticleDesign.Video:
38423845
case ArticleDesign.Audio:
3846+
case ArticleDesign.Gallery:
38433847
return sourcePalette.neutral[86];
38443848
case ArticleDesign.DeadBlog:
38453849
case ArticleDesign.LiveBlog:
@@ -3889,10 +3893,12 @@ const subMetaTextDark: PaletteFunction = ({ design, theme }) => {
38893893
case ArticleSpecial.SpecialReportAlt:
38903894
return sourcePalette.specialReportAlt[300];
38913895
default:
3892-
if (design === ArticleDesign.Picture) {
3893-
return sourcePalette.neutral[86];
3894-
} else {
3895-
return pillarPalette(theme, 500);
3896+
switch (design) {
3897+
case ArticleDesign.Picture:
3898+
case ArticleDesign.Gallery:
3899+
return sourcePalette.neutral[86];
3900+
default:
3901+
return pillarPalette(theme, 500);
38963902
}
38973903
}
38983904
};

0 commit comments

Comments
 (0)