Skip to content

Commit 53d2b9a

Browse files
Replicate prior work
This replicates the groundwork laid by @abeddow91 in #9090 Co-Authored-By: Anna Beddow <[email protected]>
1 parent 33e280f commit 53d2b9a

File tree

2 files changed

+115
-74
lines changed

2 files changed

+115
-74
lines changed

dotcom-rendering/src/layouts/DecideLayout.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ const DecideLayoutApps = ({ article, format, renderingTarget }: AppProps) => {
100100
);
101101

102102
case ArticleDesign.FullPageInteractive: {
103-
// Should be FullPageInteractiveLayout once implemented for apps
104-
return notSupported;
103+
return (
104+
<FullPageInteractiveLayout
105+
article={article}
106+
format={format}
107+
renderingTarget={renderingTarget}
108+
/>
109+
);
105110
}
106111
case ArticleDesign.LiveBlog:
107112
case ArticleDesign.DeadBlog:
@@ -157,6 +162,7 @@ const DecideLayoutWeb = ({
157162
article={article}
158163
NAV={NAV}
159164
format={format}
165+
renderingTarget={renderingTarget}
160166
/>
161167
);
162168
}
@@ -234,6 +240,7 @@ const DecideLayoutWeb = ({
234240
article={article}
235241
NAV={NAV}
236242
format={format}
243+
renderingTarget={renderingTarget}
237244
/>
238245
);
239246
}

dotcom-rendering/src/layouts/FullPageInteractiveLayout.tsx

Lines changed: 106 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,31 @@ import { palette as themePalette } from '../palette';
2424
import type { ArticleDeprecated } from '../types/article';
2525
import type { ServerSideTests, Switches } from '../types/config';
2626
import type { FEElement } from '../types/content';
27+
import type { RenderingTarget } from '../types/renderingTarget';
2728
import { interactiveGlobalStyles } from './lib/interactiveLegacyStyling';
2829
import { BannerWrapper, Stuck } from './lib/stickiness';
2930

30-
interface Props {
31+
interface CommonProps {
3132
article: ArticleDeprecated;
32-
NAV: NavType;
3333
format: ArticleFormat;
34+
renderingTarget: RenderingTarget;
35+
}
36+
37+
interface WebProps extends CommonProps {
38+
NAV: NavType;
39+
renderingTarget: 'Web';
40+
}
41+
42+
interface AppsProps extends CommonProps {
43+
renderingTarget: 'Apps';
3444
}
3545

46+
type HeaderProps = {
47+
article: ArticleDeprecated;
48+
NAV: NavType;
49+
format: ArticleFormat;
50+
};
51+
3652
type RendererProps = {
3753
format: ArticleFormat;
3854
elements: FEElement[];
@@ -120,7 +136,7 @@ const Renderer = ({
120136
return <div css={adStyles}>{output}</div>;
121137
};
122138

123-
const NavHeader = ({ article, NAV, format }: Props) => {
139+
const NavHeader = ({ article, NAV, format }: HeaderProps) => {
124140
// Typically immersives use the slim nav, but this switch is used to force
125141
// the full nav - typically during special events such as Project 200, or
126142
// the Euros. The motivation is to better onboard new visitors; interactives
@@ -180,39 +196,51 @@ const NavHeader = ({ article, NAV, format }: Props) => {
180196
);
181197
};
182198

183-
export const FullPageInteractiveLayout = ({ article, NAV, format }: Props) => {
199+
export const FullPageInteractiveLayout = (props: WebProps | AppsProps) => {
200+
const { article, format, renderingTarget } = props;
184201
const {
185202
config: { host },
186203
editionId,
187204
} = article;
205+
const isWeb = renderingTarget === 'Web';
188206

189207
return (
190208
<>
191-
{article.isLegacyInteractive && (
192-
<Global styles={interactiveGlobalStyles} />
193-
)}
194-
<header
195-
css={css`
196-
background-color: ${themePalette('--article-background')};
197-
`}
198-
>
199-
<NavHeader article={article} NAV={NAV} format={format} />
209+
{isWeb && (
210+
<>
211+
{article.isLegacyInteractive && (
212+
<Global styles={interactiveGlobalStyles} />
213+
)}
214+
<header
215+
css={css`
216+
background-color: ${themePalette(
217+
'--article-background',
218+
)};
219+
`}
220+
>
221+
<NavHeader
222+
article={article}
223+
NAV={props.NAV}
224+
format={format}
225+
/>
200226

201-
{format.theme === ArticleSpecial.Labs && (
202-
<Stuck>
203-
<Section
204-
fullWidth={true}
205-
showTopBorder={false}
206-
padSides={true}
207-
backgroundColour={sourcePalette.labs[400]}
208-
borderColour={sourcePalette.neutral[60]}
209-
sectionId="labs-header"
210-
>
211-
<LabsHeader editionId={editionId} />
212-
</Section>
213-
</Stuck>
214-
)}
215-
</header>
227+
{format.theme === ArticleSpecial.Labs && (
228+
<Stuck>
229+
<Section
230+
fullWidth={true}
231+
showTopBorder={false}
232+
padSides={true}
233+
backgroundColour={sourcePalette.labs[400]}
234+
borderColour={sourcePalette.neutral[60]}
235+
sectionId="labs-header"
236+
>
237+
<LabsHeader editionId={editionId} />
238+
</Section>
239+
</Stuck>
240+
)}
241+
</header>
242+
</>
243+
)}
216244

217245
<Section
218246
fullWidth={true}
@@ -246,7 +274,7 @@ export const FullPageInteractiveLayout = ({ article, NAV, format }: Props) => {
246274
</article>
247275
</Section>
248276

249-
{NAV.subNavSections && (
277+
{isWeb && props.NAV.subNavSections && (
250278
<Section
251279
fullWidth={true}
252280
padSides={false}
@@ -255,60 +283,66 @@ export const FullPageInteractiveLayout = ({ article, NAV, format }: Props) => {
255283
>
256284
<Island priority="enhancement" defer={{ until: 'visible' }}>
257285
<SubNav
258-
subNavSections={NAV.subNavSections}
259-
currentNavLink={NAV.currentNavLink}
286+
subNavSections={props.NAV.subNavSections}
287+
currentNavLink={props.NAV.currentNavLink}
260288
position="footer"
261289
isInteractive={true}
262290
/>
263291
</Island>
264292
</Section>
265293
)}
266294

267-
<Section
268-
fullWidth={true}
269-
padSides={false}
270-
backgroundColour={sourcePalette.brand[400]}
271-
borderColour={sourcePalette.brand[600]}
272-
showSideBorders={false}
273-
element="footer"
274-
>
275-
<Footer
276-
pageFooter={article.pageFooter}
277-
selectedPillar={NAV.selectedPillar}
278-
pillars={NAV.pillars}
279-
urls={article.nav.readerRevenueLinks.footer}
280-
editionId={article.editionId}
281-
/>
282-
</Section>
295+
{isWeb && (
296+
<>
297+
<Section
298+
fullWidth={true}
299+
padSides={false}
300+
backgroundColour={sourcePalette.brand[400]}
301+
borderColour={sourcePalette.brand[600]}
302+
showSideBorders={false}
303+
element="footer"
304+
>
305+
<Footer
306+
pageFooter={article.pageFooter}
307+
selectedPillar={props.NAV.selectedPillar}
308+
pillars={props.NAV.pillars}
309+
urls={article.nav.readerRevenueLinks.header}
310+
editionId={article.editionId}
311+
/>
312+
</Section>
283313

284-
<BannerWrapper>
285-
<Island priority="feature" defer={{ until: 'idle' }}>
286-
<StickyBottomBanner
314+
<BannerWrapper>
315+
<Island priority="feature" defer={{ until: 'idle' }}>
316+
<StickyBottomBanner
317+
contentType={article.contentType}
318+
contributionsServiceUrl={
319+
article.contributionsServiceUrl
320+
}
321+
idApiUrl={article.config.idApiUrl}
322+
isMinuteArticle={
323+
article.pageType.isMinuteArticle
324+
}
325+
isPaidContent={article.pageType.isPaidContent}
326+
isPreview={!!article.config.isPreview}
327+
isSensitive={article.config.isSensitive}
328+
pageId={article.pageId}
329+
sectionId={article.config.section}
330+
shouldHideReaderRevenue={
331+
article.shouldHideReaderRevenue
332+
}
333+
remoteBannerSwitch={
334+
!!article.config.switches.remoteBanner
335+
}
336+
tags={article.tags}
337+
/>
338+
</Island>
339+
</BannerWrapper>
340+
<MobileStickyContainer
287341
contentType={article.contentType}
288-
contributionsServiceUrl={
289-
article.contributionsServiceUrl
290-
}
291-
idApiUrl={article.config.idApiUrl}
292-
isMinuteArticle={article.pageType.isMinuteArticle}
293-
isPaidContent={article.pageType.isPaidContent}
294-
isPreview={!!article.config.isPreview}
295-
isSensitive={article.config.isSensitive}
296342
pageId={article.pageId}
297-
sectionId={article.config.section}
298-
shouldHideReaderRevenue={
299-
article.shouldHideReaderRevenue
300-
}
301-
remoteBannerSwitch={
302-
!!article.config.switches.remoteBanner
303-
}
304-
tags={article.tags}
305343
/>
306-
</Island>
307-
</BannerWrapper>
308-
<MobileStickyContainer
309-
contentType={article.contentType}
310-
pageId={article.pageId}
311-
/>
344+
</>
345+
)}
312346
</>
313347
);
314348
};

0 commit comments

Comments
 (0)