Skip to content
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

Add dark mode colours for NumberedList titles #9788

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { css } from '@emotion/react';
import { headline } from '@guardian/source-foundations';
import { decideFormat } from '../lib/decideFormat';
import { decidePalette } from '../lib/decidePalette';
import { palette as sourcePalette } from '../palette';
ioannakok marked this conversation as resolved.
Show resolved Hide resolved
import type { Palette } from '../types/palette';

type Props = {
Expand All @@ -18,7 +19,7 @@ const titleStyles = (palette: Palette) => css`
strong {
${headline.medium({ fontWeight: 'bold' })}
display: block;
color: ${palette.text.numberedTitle};
color: ${sourcePalette('--numbered-list-title')};
}
`;

Expand Down
5 changes: 0 additions & 5 deletions dotcom-rendering/src/lib/decidePalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1106,10 +1106,6 @@ const textDateLine = (format: ArticleFormat): string => {
return neutral[46];
};

const textNumberedTitle = (format: ArticleFormat): string => {
return pillarPalette[format.theme].main;
};

const textNumberedPosition = (): string => {
return text.supporting;
};
Expand Down Expand Up @@ -1388,7 +1384,6 @@ export const decidePalette = (
witnessAuthor: textWitnessAuthor(format),
witnessTitle: textWitnessTitle(format),
carouselTitle: textCarouselTitle(format),
numberedTitle: textNumberedTitle(format),
numberedPosition: textNumberedPosition(),
cricketScoreboardLink: textCricketScoreboardLink(),
filterButton: textFilterButton(),
Expand Down
38 changes: 38 additions & 0 deletions dotcom-rendering/src/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2457,6 +2457,40 @@ const keyEventButtonFillLight: PaletteFunction = () =>
sourcePalette.neutral[100];
const keyEventButtonFillDark: PaletteFunction = () => sourcePalette.neutral[7];

const numberedListTitleLight: PaletteFunction = ({ theme }) => {
switch (theme) {
case Pillar.News:
case Pillar.Sport:
case Pillar.Lifestyle:
case Pillar.Culture:
case Pillar.Opinion:
return pillarPalette(theme, 400);
case ArticleSpecial.Labs:
return sourcePalette.labs[400];
case ArticleSpecial.SpecialReport:
return sourcePalette.specialReport[400];
case ArticleSpecial.SpecialReportAlt:
return sourcePalette.specialReportAlt[200];
}
};

const numberedListTitleDark: PaletteFunction = ({ theme }) => {
switch (theme) {
case Pillar.News:
case Pillar.Sport:
case Pillar.Lifestyle:
case Pillar.Culture:
case Pillar.Opinion:
return pillarPalette(theme, 500);
case ArticleSpecial.Labs:
return sourcePalette.labs[400];
case ArticleSpecial.SpecialReport:
return sourcePalette.specialReport[500];
case ArticleSpecial.SpecialReportAlt:
return sourcePalette.specialReportAlt[300];
}
};

const summaryEventBulletLight: PaletteFunction = ({ theme }) => {
switch (theme) {
case Pillar.News:
Expand Down Expand Up @@ -3887,6 +3921,10 @@ const paletteColours = {
light: keyEventButtonFillLight,
dark: keyEventButtonFillDark,
},
'--numbered-list-title': {
light: numberedListTitleLight,
dark: numberedListTitleDark,
},
'--summary-event-bullet': {
light: summaryEventBulletLight,
dark: summaryEventBulletDark,
Expand Down
1 change: 0 additions & 1 deletion dotcom-rendering/src/types/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export type Palette = {
witnessTitle: Colour;
carouselTitle: Colour;
pagination: Colour;
numberedTitle: Colour;
numberedPosition: Colour;
cricketScoreboardLink: Colour;
filterButton: Colour;
Expand Down
Loading