Skip to content

Commit 08fc679

Browse files
committed
Add section colours for news, culture, lifestyle, opinion, sport
1 parent 78a6ede commit 08fc679

File tree

2 files changed

+132
-11
lines changed

2 files changed

+132
-11
lines changed

dotcom-rendering/src/components/FrontSection.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,24 @@ const bottomPaddingBetaContainer = (
401401
}
402402
`;
403403

404-
const primaryLevelTopBorder = css`
404+
const primaryLevelTopBorder = (title?: string) => css`
405405
grid-row: 1;
406406
grid-column: 1 / -1;
407-
border-top: 2px solid ${schemePalette('--section-border-primary')};
408407
/** Ensures the top border sits above the side borders */
409408
z-index: 1;
410409
height: fit-content;
410+
411+
border-top: 2px solid ${schemePalette('--section-border-primary')};
412+
${title === 'News' &&
413+
`border-top: 2px solid ${schemePalette('--section-border-news')};`}
414+
${title === 'Opinion' &&
415+
`border-top: 2px solid ${schemePalette('--section-border-opinion')};`}
416+
${title === 'Sport' &&
417+
`border-top: 2px solid ${schemePalette('--section-border-sport')};`}
418+
${title === 'Lifestyle' &&
419+
`border-top: 2px solid ${schemePalette('--section-border-lifestyle')};`}
420+
${title === 'Culture' &&
421+
`border-top: 2px solid ${schemePalette('--section-border-culture')};`}
411422
`;
412423

413424
const secondaryLevelTopBorder = css`
@@ -425,6 +436,23 @@ const carouselNavigationPlaceholder = css`
425436
}
426437
`;
427438

439+
const articleSectionTitleStyles = (title?: string): string => {
440+
switch (title) {
441+
case 'News':
442+
return schemePalette('--article-section-title-news');
443+
case 'Opinion':
444+
return schemePalette('--article-section-title-opinion');
445+
case 'Sport':
446+
return schemePalette('--article-section-title-sport');
447+
case 'Lifestyle':
448+
return schemePalette('--article-section-title-lifestyle');
449+
case 'Culture':
450+
return schemePalette('--article-section-title-culture');
451+
default:
452+
return schemePalette('--article-section-title');
453+
}
454+
};
455+
428456
/**
429457
* # Front Container
430458
*
@@ -590,7 +618,7 @@ export const FrontSection = ({
590618
css={[
591619
containerLevel === 'Secondary'
592620
? secondaryLevelTopBorder
593-
: primaryLevelTopBorder,
621+
: primaryLevelTopBorder(title),
594622
]}
595623
/>
596624
)}
@@ -629,9 +657,7 @@ export const FrontSection = ({
629657
? schemePalette(
630658
'--article-section-secondary-title',
631659
)
632-
: schemePalette(
633-
'--article-section-title',
634-
)
660+
: articleSectionTitleStyles(title)
635661
}
636662
// On paid fronts the title is not treated as a link
637663
url={!isOnPaidContentFront ? url : undefined}

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 100 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,10 +3064,65 @@ const articleSectionBackgroundDark: PaletteFunction = () =>
30643064

30653065
const articleSectionTitleLight: PaletteFunction = () =>
30663066
sourcePalette.neutral[0];
3067-
30683067
const articleSectionTitleDark: PaletteFunction = () =>
30693068
sourcePalette.neutral[86];
30703069

3070+
const articleSectionTitleNewsLight: PaletteFunction = () =>
3071+
sourcePalette.neutral[7];
3072+
const articleSectionTitleNewsDark: PaletteFunction = () =>
3073+
sourcePalette.neutral[86];
3074+
3075+
const articleSectionTitleOpinionLight: PaletteFunction = () =>
3076+
sourcePalette.opinion[400];
3077+
const articleSectionTitleOpinionDark: PaletteFunction = () =>
3078+
sourcePalette.opinion[500];
3079+
3080+
const articleSectionTitleSportLight: PaletteFunction = () =>
3081+
sourcePalette.sport[400];
3082+
const articleSectionTitleSportDark: PaletteFunction = () =>
3083+
sourcePalette.sport[500];
3084+
3085+
const articleSectionTitleLifestyleLight: PaletteFunction = () =>
3086+
sourcePalette.lifestyle[400];
3087+
const articleSectionTitleLifestyleDark: PaletteFunction = () =>
3088+
sourcePalette.lifestyle[450];
3089+
3090+
const articleSectionTitleCultureLight: PaletteFunction = () =>
3091+
sourcePalette.culture[400];
3092+
const articleSectionTitleCultureDark: PaletteFunction = () =>
3093+
sourcePalette.culture[450];
3094+
3095+
const sectionBorderPrimaryLight: PaletteFunction = () =>
3096+
sourcePalette.neutral[20];
3097+
const sectionBorderPrimaryDark: PaletteFunction = () =>
3098+
sourcePalette.neutral[38];
3099+
3100+
const sectionBorderSecondaryLight: PaletteFunction = () =>
3101+
sourcePalette.neutral[73];
3102+
const sectionBorderSecondaryDark: PaletteFunction = () =>
3103+
sourcePalette.neutral[38];
3104+
3105+
const sectionBorderNewsLight: PaletteFunction = () => sourcePalette.neutral[20];
3106+
const sectionBorderNewsDark: PaletteFunction = () => sourcePalette.neutral[38];
3107+
3108+
const sectionBorderOpinionLight: PaletteFunction = () =>
3109+
sourcePalette.opinion[450];
3110+
const sectionBorderOpinionDark: PaletteFunction = () =>
3111+
sourcePalette.opinion[450];
3112+
3113+
const sectionBorderSportLight: PaletteFunction = () => sourcePalette.sport[400];
3114+
const sectionBorderSportDark: PaletteFunction = () => sourcePalette.sport[400];
3115+
3116+
const sectionBorderLifestyleLight: PaletteFunction = () =>
3117+
sourcePalette.lifestyle[400];
3118+
const sectionBorderLifestyleDark: PaletteFunction = () =>
3119+
sourcePalette.lifestyle[400];
3120+
3121+
const sectionBorderCultureLight: PaletteFunction = () =>
3122+
sourcePalette.culture[400];
3123+
const sectionBorderCultureDark: PaletteFunction = () =>
3124+
sourcePalette.culture[400];
3125+
30713126
const articleSectionSecondaryTitleLight: PaletteFunction = () =>
30723127
sourcePalette.neutral[20];
30733128

@@ -6107,6 +6162,26 @@ const paletteColours = {
61076162
light: articleSectionTitleLight,
61086163
dark: articleSectionTitleDark,
61096164
},
6165+
'--article-section-title-culture': {
6166+
light: articleSectionTitleCultureLight,
6167+
dark: articleSectionTitleCultureDark,
6168+
},
6169+
'--article-section-title-lifestyle': {
6170+
light: articleSectionTitleLifestyleLight,
6171+
dark: articleSectionTitleLifestyleDark,
6172+
},
6173+
'--article-section-title-news': {
6174+
light: articleSectionTitleNewsLight,
6175+
dark: articleSectionTitleNewsDark,
6176+
},
6177+
'--article-section-title-opinion': {
6178+
light: articleSectionTitleOpinionLight,
6179+
dark: articleSectionTitleOpinionDark,
6180+
},
6181+
'--article-section-title-sport': {
6182+
light: articleSectionTitleSportLight,
6183+
dark: articleSectionTitleSportDark,
6184+
},
61106185
'--article-text': {
61116186
light: articleTextLight,
61126187
dark: articleTextDark,
@@ -7268,13 +7343,33 @@ const paletteColours = {
72687343
light: () => sourcePalette.neutral[86],
72697344
dark: () => sourcePalette.neutral[20],
72707345
},
7346+
'--section-border-culture': {
7347+
light: sectionBorderCultureLight,
7348+
dark: sectionBorderCultureDark,
7349+
},
7350+
'--section-border-lifestyle': {
7351+
light: sectionBorderLifestyleLight,
7352+
dark: sectionBorderLifestyleDark,
7353+
},
7354+
'--section-border-news': {
7355+
light: sectionBorderNewsLight,
7356+
dark: sectionBorderNewsDark,
7357+
},
7358+
'--section-border-opinion': {
7359+
light: sectionBorderOpinionLight,
7360+
dark: sectionBorderOpinionDark,
7361+
},
72717362
'--section-border-primary': {
7272-
light: () => sourcePalette.neutral[20],
7273-
dark: () => sourcePalette.neutral[86],
7363+
light: sectionBorderPrimaryLight,
7364+
dark: sectionBorderPrimaryDark,
72747365
},
72757366
'--section-border-secondary': {
7276-
light: () => sourcePalette.neutral[73],
7277-
dark: () => sourcePalette.neutral[38],
7367+
light: sectionBorderSecondaryLight,
7368+
dark: sectionBorderSecondaryDark,
7369+
},
7370+
'--section-border-sport': {
7371+
light: sectionBorderSportLight,
7372+
dark: sectionBorderSportDark,
72787373
},
72797374
'--section-date': {
72807375
light: () => sourcePalette.news[400],

0 commit comments

Comments
 (0)