Skip to content

Add footer to gallery layout #14145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 101 additions & 20 deletions dotcom-rendering/src/components/AppsFooter.importable.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
import { css } from '@emotion/react';
import { remSpace, textSans15 } from '@guardian/source/foundations';
import {
between,
from,
remSpace,
space,
textSans15,
until,
} from '@guardian/source/foundations';
import { ButtonLink } from '@guardian/source/react-components';
import { useEffect, useState } from 'react';
import { grid } from '../grid';
import { ArticleDesign } from '../lib/articleFormat';
import { getNavigationClient, getUserClient } from '../lib/bridgetApi';
import { palette } from '../palette';

const year = new Date().getFullYear();

const footerStyles = css`
${textSans15}
padding: ${remSpace[4]} ${remSpace[3]};
background-color: ${palette('--apps-footer-background')};
const footerContainerStyles = (design?: ArticleDesign) => {
if (design === ArticleDesign.Gallery) {
return css`
${textSans15}
${grid.paddedContainer}
background-color: ${palette('--apps-footer-background')};

${until.tablet} {
padding-top: ${space[1]}px;
}

${from.tablet} {
border-left: 1px solid ${palette('--footer-border')};
border-right: 1px solid ${palette('--footer-border')};
}
`;
} else {
return css`
${textSans15}
padding: ${remSpace[4]} ${remSpace[3]};
background-color: ${palette('--apps-footer-background')};
`;
}
};

const galleryFooterStyles = css`
${grid.column.centre}
padding: ${remSpace[4]} 0;

${from.leftCol} {
${grid.between('centre-column-start', 'right-column-end')}
}
`;

const linkStyles = css`
Expand Down Expand Up @@ -62,7 +99,40 @@ const PrivacySettings = ({
}
};

export const AppsFooter = () => {
const galleryBorder = css`
grid-row: 1 / 3;
position: relative;

${between.desktop.and.leftCol} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these styles working as intended? I can't see the line at this breakpoint 🤔.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot, the problem was that I had to give it a grid-row: 1 / 3;. Now the line appears :)

${grid.column.right}

&::before {
content: '';
position: absolute;
left: -10px; /* 10px to the left of this element */
top: 0;
bottom: 0;
width: 1px;
background-color: ${palette('--footer-border')};
}
}

${from.leftCol} {
${grid.column.left}

&::after {
content: '';
position: absolute;
right: -10px;
top: 0;
bottom: 0;
width: 1px;
background-color: ${palette('--footer-border')};
}
}
`;

export const AppsFooter = ({ design }: { design?: ArticleDesign }) => {
const [isCcpa, setIsCcpa] = useState<boolean>(false);

useEffect(() => {
Expand Down Expand Up @@ -90,21 +160,32 @@ export const AppsFooter = () => {
};

return (
<div css={footerStyles}>
&#169; {year} Guardian News and Media Limited or its affiliated
companies. All rights reserved. (dcar)
<br />
<PrivacySettings
isCcpa={isCcpa}
privacySettingsClickHandler={privacySettingsClickHandler}
/>
<ButtonLink
priority="secondary"
onClick={privacyPolicyClickHandler}
cssOverrides={linkStyles}
<div css={footerContainerStyles(design)}>
{design === ArticleDesign.Gallery && (
<div css={galleryBorder}></div>
)}
<div
css={
design === ArticleDesign.Gallery
? galleryFooterStyles
: undefined
}
>
Privacy Policy
</ButtonLink>
&#169; {year} Guardian News and Media Limited or its affiliated
companies. All rights reserved. (dcar)
<br />
<PrivacySettings
isCcpa={isCcpa}
privacySettingsClickHandler={privacySettingsClickHandler}
/>
<ButtonLink
priority="secondary"
onClick={privacyPolicyClickHandler}
cssOverrides={linkStyles}
>
Privacy Policy
</ButtonLink>
</div>
</div>
);
};
68 changes: 60 additions & 8 deletions dotcom-rendering/src/components/SubMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { css, type SerializedStyles } from '@emotion/react';
import {
between,
from,
space,
textSans12,
Expand Down Expand Up @@ -81,12 +82,21 @@ const listStyles = css`
background-repeat: no-repeat;
`;

const listWrapper = (design: ArticleDesign): SerializedStyles => css`
${design === ArticleDesign.Gallery ? grid.column.centre : undefined};
padding-bottom: 0.75rem;
margin-bottom: 6px;
border-bottom: 1px solid ${palette('--article-border')};
`;
const listWrapper = (design: ArticleDesign): SerializedStyles => {
if (design === ArticleDesign.Gallery) {
return css`
${grid.column.centre}
padding-bottom: 0.75rem;
margin-bottom: 6px;
`;
}

return css`
padding-bottom: 0.75rem;
margin-bottom: 6px;
border-bottom: 1px solid ${palette('--article-border')};
`;
};

const listItemStyles = css`
${textSans14};
Expand Down Expand Up @@ -130,6 +140,46 @@ const syndicationButtonOverrides = css`
const galleryStyles = css`
${grid.paddedContainer};
background-color: ${palette('--article-inner-background')};
border-bottom: 1px solid var(--article-border);
padding: 0;

${from.tablet} {
border-left: 1px solid ${palette('--article-border')};
border-right: 1px solid ${palette('--article-border')};
}
`;

const galleryBorder = css`
grid-row: 1 / 3;
position: relative; /* allows the ::before & ::after to be positioned relative to this */

${between.desktop.and.leftCol} {
${grid.column.right}

&::before {
content: '';
position: absolute;
left: -10px; /* 10px to the left of this element */
top: 0;
bottom: 0;
width: 1px;
background-color: ${palette('--article-border')};
}
}

${from.leftCol} {
${grid.column.left}

&::after {
content: '';
position: absolute;
right: -10px;
top: 0;
bottom: 0;
width: 1px;
background-color: ${palette('--article-border')};
}
}
`;

export const SubMeta = ({
Expand Down Expand Up @@ -160,15 +210,17 @@ export const SubMeta = ({
<div
data-print-layout="hide"
css={[
bottomPadding,
format.design === ArticleDesign.Interactive
? setMetaWidth
: undefined,
format.design === ArticleDesign.Gallery
? galleryStyles
: undefined,
: bottomPadding,
]}
>
{format.design === ArticleDesign.Gallery && (
<div css={galleryBorder}></div>
)}
{hasLinks && (
<>
<span css={labelStyles(format.design)}>
Expand Down
51 changes: 45 additions & 6 deletions dotcom-rendering/src/layouts/GalleryLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { css } from '@emotion/react';
import { between, from } from '@guardian/source/foundations';
import {
between,
from,
palette as sourcePalette,
} from '@guardian/source/foundations';
import { AppsFooter } from '../components/AppsFooter.importable';
import { ArticleHeadline } from '../components/ArticleHeadline';
import { ArticleMetaApps } from '../components/ArticleMeta.apps';
import { ArticleMeta } from '../components/ArticleMeta.web';
import { ArticleTitle } from '../components/ArticleTitle';
import { Footer } from '../components/Footer';
import { GalleryImage } from '../components/GalleryImage';
import { Island } from '../components/Island';
import { MainMediaGallery } from '../components/MainMediaGallery';
import { Masthead } from '../components/Masthead/Masthead';
import { Section } from '../components/Section';
import { Standfirst } from '../components/Standfirst';
import { SubMeta } from '../components/SubMeta';
import { grid } from '../grid';
Expand Down Expand Up @@ -49,6 +57,9 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
const gallery = props.gallery;
const frontendData = gallery.frontendData;

const isWeb = props.renderingTarget === 'Web';
const isApps = props.renderingTarget === 'Apps';

const format: ArticleFormat = {
design: gallery.design,
display: gallery.display,
Expand All @@ -57,7 +68,7 @@ export const GalleryLayout = (props: WebProps | AppProps) => {

return (
<>
{props.renderingTarget === 'Web' && (
{isWeb && (
<Masthead
nav={props.NAV}
editionId={frontendData.editionId}
Expand Down Expand Up @@ -106,7 +117,7 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
format={format}
standfirst={frontendData.standfirst}
/>
{props.renderingTarget === 'Web' ? (
{isWeb ? (
<ArticleMeta
branding={
frontendData.commercialProperties[
Expand All @@ -131,7 +142,7 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
shortUrlId={frontendData.config.shortUrlId}
/>
) : null}
{props.renderingTarget === 'Apps' ? (
{isApps ? (
<ArticleMetaApps
branding={
frontendData.commercialProperties[
Expand Down Expand Up @@ -199,11 +210,39 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
webUrl={frontendData.webURL}
webTitle={frontendData.webTitle}
showBottomSocialButtons={
frontendData.showBottomSocialButtons &&
props.renderingTarget === 'Web'
frontendData.showBottomSocialButtons && isWeb
}
/>
</main>
{isWeb && (
<Section
fullWidth={true}
padSides={false}
backgroundColour={sourcePalette.brand[400]}
borderColour={sourcePalette.brand[600]}
showSideBorders={false}
element="footer"
>
<Footer
pageFooter={frontendData.pageFooter}
selectedPillar={props.NAV.selectedPillar}
pillars={props.NAV.pillars}
urls={frontendData.nav.readerRevenueLinks.footer}
editionId={frontendData.editionId}
/>
</Section>
)}
{isApps && (
<div
css={{
backgroundColor: palette('--apps-footer-background'),
}}
>
<Island priority="critical">
<AppsFooter design={format.design} />
</Island>
</div>
)}
</>
);
};
Loading