Skip to content

Commit 7d06a2c

Browse files
JamieB-gumarjisound
andcommitted
Added meta component to galleries for apps
Co-authored-by: Marjan Kalanaki <[email protected]>
1 parent 2d6c27a commit 7d06a2c

File tree

4 files changed

+103
-35
lines changed

4 files changed

+103
-35
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Pillar,
1010
} from '../lib/articleFormat';
1111
import { ArticleMetaApps } from './ArticleMeta.apps';
12+
import { palette } from '../palette';
1213

1314
const meta = {
1415
component: ArticleMetaApps,
@@ -186,3 +187,23 @@ export const WithBrandingStoryForAdvertisingPartner = {
186187
},
187188
},
188189
} satisfies Story;
190+
191+
export const GalleryDesign = {
192+
args: {
193+
...WithFollowStory.args,
194+
isCommentable: true,
195+
},
196+
parameters: {
197+
formats: getAllThemes({
198+
display: ArticleDisplay.Standard,
199+
design: ArticleDesign.Gallery,
200+
}),
201+
config: {
202+
renderingTarget: 'Apps',
203+
},
204+
colourSchemeBackground: {
205+
light: palette('--article-background'),
206+
dark: palette('--article-background'),
207+
},
208+
},
209+
} satisfies Story;

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { Dateline } from './Dateline';
2222
import { FollowWrapper } from './FollowWrapper.importable';
2323
import { Island } from './Island';
2424
import { LiveblogNotifications } from './LiveblogNotifications.importable';
25+
import { grid } from '../grid';
2526

2627
type Props = {
2728
format: ArticleFormat;
@@ -224,6 +225,7 @@ export const ArticleMetaApps = ({
224225
const isImmersive = format.display === ArticleDisplay.Immersive;
225226
const isAnalysis = format.design === ArticleDesign.Analysis;
226227
const isLiveBlog = format.design === ArticleDesign.LiveBlog;
228+
const isGallery = format.design === ArticleDesign.Gallery;
227229

228230
const shouldShowFollowButtons = (layoutOrDesignType: boolean) =>
229231
layoutOrDesignType && !!byline && !isUndefined(soleContributor);
@@ -239,7 +241,16 @@ export const ArticleMetaApps = ({
239241
className={
240242
isInteractive ? interactiveLegacyClasses.metaContainer : ''
241243
}
242-
css={metaContainerMargins}
244+
css={[
245+
metaContainerMargins,
246+
isGallery ? grid.column.centre : undefined,
247+
isGallery
248+
? {
249+
marginLeft: space[3],
250+
paddingBottom: space[2],
251+
}
252+
: undefined,
253+
]}
243254
>
244255
<div
245256
css={[

dotcom-rendering/src/layouts/GalleryLayout.stories.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { WithBranding } from '../components/ArticleMeta.web.stories';
44
import { ArticleDesign } from '../lib/articleFormat';
55
import { getCurrentPillar } from '../lib/layoutHelpers';
66
import { extractNAV } from '../model/extract-nav';
7-
import { enhanceArticleType } from '../types/article';
7+
import { enhanceArticleType, type Gallery } from '../types/article';
88
import { GalleryLayout } from './GalleryLayout';
99

1010
const meta = {
@@ -16,6 +16,20 @@ export default meta;
1616

1717
type Story = StoryObj<typeof meta>;
1818

19+
const addBranding = (gallery: Gallery): Gallery => ({
20+
...gallery,
21+
frontendData: {
22+
...gallery.frontendData,
23+
commercialProperties: {
24+
...gallery.frontendData.commercialProperties,
25+
UK: {
26+
...gallery.frontendData.commercialProperties.UK,
27+
branding: WithBranding.args.branding,
28+
},
29+
},
30+
},
31+
});
32+
1933
const appsArticle = enhanceArticleType(GalleryFixture, 'Apps');
2034

2135
if (appsArticle.design !== ArticleDesign.Gallery) {
@@ -25,7 +39,7 @@ if (appsArticle.design !== ArticleDesign.Gallery) {
2539
export const Apps = {
2640
args: {
2741
renderingTarget: 'Apps',
28-
gallery: appsArticle,
42+
gallery: addBranding(appsArticle),
2943
},
3044
parameters: {
3145
formats: [
@@ -35,6 +49,9 @@ export const Apps = {
3549
theme: appsArticle.theme,
3650
},
3751
],
52+
config: {
53+
renderingTarget: 'Apps',
54+
},
3855
},
3956
} satisfies Story;
4057

@@ -51,19 +68,7 @@ export const Web = {
5168
...extractNAV(webArticle.frontendData.nav),
5269
selectedPillar: getCurrentPillar(webArticle.frontendData),
5370
},
54-
gallery: {
55-
...webArticle,
56-
frontendData: {
57-
...webArticle.frontendData,
58-
commercialProperties: {
59-
...webArticle.frontendData.commercialProperties,
60-
UK: {
61-
...webArticle.frontendData.commercialProperties.UK,
62-
branding: WithBranding.args.branding,
63-
},
64-
},
65-
},
66-
},
71+
gallery: addBranding(webArticle),
6772
},
6873
parameters: {
6974
formats: [

dotcom-rendering/src/layouts/GalleryLayout.tsx

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { NavType } from '../model/extract-nav';
1212
import { palette } from '../palette';
1313
import type { Gallery } from '../types/article';
1414
import type { RenderingTarget } from '../types/renderingTarget';
15+
import { ArticleMetaApps } from '../components/ArticleMeta.apps';
1516

1617
interface Props {
1718
gallery: Gallery;
@@ -94,25 +95,55 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
9495
format={format}
9596
standfirst={frontendData.standfirst}
9697
/>
97-
<ArticleMeta
98-
branding={
99-
frontendData.commercialProperties[
100-
frontendData.editionId
101-
].branding
102-
}
103-
format={format}
104-
pageId={frontendData.pageId}
105-
webTitle={frontendData.webTitle}
106-
byline={frontendData.byline}
107-
tags={frontendData.tags}
108-
primaryDateline={frontendData.webPublicationDateDisplay}
109-
secondaryDateline={
110-
frontendData.webPublicationSecondaryDateDisplay
111-
}
112-
isCommentable={frontendData.isCommentable}
113-
discussionApiUrl={frontendData.config.discussionApiUrl}
114-
shortUrlId={frontendData.config.shortUrlId}
115-
/>
98+
{props.renderingTarget === 'Web' ? (
99+
<ArticleMeta
100+
branding={
101+
frontendData.commercialProperties[
102+
frontendData.editionId
103+
].branding
104+
}
105+
format={format}
106+
pageId={frontendData.pageId}
107+
webTitle={frontendData.webTitle}
108+
byline={frontendData.byline}
109+
tags={frontendData.tags}
110+
primaryDateline={
111+
frontendData.webPublicationDateDisplay
112+
}
113+
secondaryDateline={
114+
frontendData.webPublicationSecondaryDateDisplay
115+
}
116+
isCommentable={frontendData.isCommentable}
117+
discussionApiUrl={
118+
frontendData.config.discussionApiUrl
119+
}
120+
shortUrlId={frontendData.config.shortUrlId}
121+
/>
122+
) : null}
123+
{props.renderingTarget === 'Apps' ? (
124+
<ArticleMetaApps
125+
branding={
126+
frontendData.commercialProperties[
127+
frontendData.editionId
128+
].branding
129+
}
130+
format={format}
131+
pageId={frontendData.pageId}
132+
byline={frontendData.byline}
133+
tags={frontendData.tags}
134+
primaryDateline={
135+
frontendData.webPublicationDateDisplay
136+
}
137+
secondaryDateline={
138+
frontendData.webPublicationSecondaryDateDisplay
139+
}
140+
isCommentable={frontendData.isCommentable}
141+
discussionApiUrl={
142+
frontendData.config.discussionApiUrl
143+
}
144+
shortUrlId={frontendData.config.shortUrlId}
145+
/>
146+
) : null}
116147
<div
117148
css={[
118149
border,

0 commit comments

Comments
 (0)