Skip to content

Commit 0ce7326

Browse files
committed
Restrict pillar colours for sections and borders to network fronts
1 parent 04b016b commit 0ce7326

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

dotcom-rendering/src/components/FrontSection.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { css } from '@emotion/react';
22
import { isString } from '@guardian/libs';
33
import { between, from, space, until } from '@guardian/source/foundations';
44
import { pageSkinContainer } from '../layouts/lib/pageSkin';
5-
import type { EditionId } from '../lib/edition';
5+
import {
6+
type EditionId,
7+
isNetworkFront as isNetworkFrontExternal,
8+
} from '../lib/edition';
69
import { hideAge } from '../lib/hideAge';
710
import { palette, palette as schemePalette } from '../palette';
811
import type { CollectionBranding } from '../types/branding';
@@ -98,13 +101,21 @@ type Props = {
98101
const width = (columns: number, columnWidth: number, columnGap: number) =>
99102
`width: ${columns * columnWidth + (columns - 1) * columnGap}px;`;
100103

101-
const borderColourStyles = (title?: string): string => {
104+
const borderColourStyles = (
105+
title?: string,
106+
isNetworkFront?: boolean,
107+
): string => {
108+
if (!isNetworkFront) {
109+
return schemePalette('--section-border-primary');
110+
}
111+
102112
switch (title) {
103113
case 'News':
104114
return schemePalette('--section-border-news');
105115
case 'Opinion':
106116
return schemePalette('--section-border-opinion');
107117
case 'Sport':
118+
case 'Sports':
108119
return schemePalette('--section-border-sport');
109120
case 'Lifestyle':
110121
return schemePalette('--section-border-lifestyle');
@@ -115,13 +126,21 @@ const borderColourStyles = (title?: string): string => {
115126
}
116127
};
117128

118-
const articleSectionTitleStyles = (title?: string): string => {
129+
const articleSectionTitleStyles = (
130+
title?: string,
131+
isNetworkFront?: boolean,
132+
): string => {
133+
if (!isNetworkFront) {
134+
return schemePalette('--article-section-title');
135+
}
136+
119137
switch (title) {
120138
case 'News':
121139
return schemePalette('--article-section-title-news');
122140
case 'Opinion':
123141
return schemePalette('--article-section-title-opinion');
124142
case 'Sport':
143+
case 'Sports':
125144
return schemePalette('--article-section-title-sport');
126145
case 'Lifestyle':
127146
return schemePalette('--article-section-title-lifestyle');
@@ -435,10 +454,10 @@ const bottomPaddingBetaContainer = (
435454
}
436455
`;
437456

438-
const primaryLevelTopBorder = (title?: string) => css`
457+
const primaryLevelTopBorder = (title?: string, isNetworkFront?: boolean) => css`
439458
grid-row: 1;
440459
grid-column: 1 / -1;
441-
border-top: 2px solid ${borderColourStyles(title)};
460+
border-top: 2px solid ${borderColourStyles(title, isNetworkFront)};
442461
/** Ensures the top border sits above the side borders */
443462
z-index: 1;
444463
height: fit-content;
@@ -591,6 +610,7 @@ export const FrontSection = ({
591610
const useLargeSpacingDesktop =
592611
!!isNextCollectionPrimary || isAboveDesktopAd;
593612

613+
const isNetworkFront = isNetworkFrontExternal(pageId ?? '');
594614
/**
595615
* id is being used to set the containerId in @see {ShowMore.importable.tsx}
596616
* this id pre-existed showMore so is probably also being used for something else.
@@ -624,7 +644,7 @@ export const FrontSection = ({
624644
css={[
625645
containerLevel === 'Secondary'
626646
? secondaryLevelTopBorder
627-
: primaryLevelTopBorder(title),
647+
: primaryLevelTopBorder(title, isNetworkFront),
628648
]}
629649
/>
630650
)}
@@ -663,7 +683,10 @@ export const FrontSection = ({
663683
? schemePalette(
664684
'--article-section-secondary-title',
665685
)
666-
: articleSectionTitleStyles(title)
686+
: articleSectionTitleStyles(
687+
title,
688+
isNetworkFront,
689+
)
667690
}
668691
// On paid fronts the title is not treated as a link
669692
url={!isOnPaidContentFront ? url : undefined}

0 commit comments

Comments
 (0)