Skip to content

Commit f25fb49

Browse files
committed
Fix dark mode colours
1 parent 477ec8d commit f25fb49

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ export const Card = ({
689689
* - Renders `SupportingContent` for all breakpoints if `sublinkPosition` is `outer`.
690690
* - If `sublinkPosition` is `inner`, hides `SupportingContent` from tablet but displays it on smaller breakpoints.
691691
*/
692-
const decideSublinks = () => {
692+
const decideOuterSublinks = () => {
693693
if (!hasSublinks) return null;
694694
if (sublinkPosition === 'none') return null;
695695

@@ -699,6 +699,7 @@ export const Card = ({
699699
containerPalette={containerPalette}
700700
alignment={supportingContentAlignment}
701701
isDynamo={isDynamo}
702+
isMedia={isMediaCard(format)}
702703
fillBackgroundOnMobile={
703704
!!isFlexSplash ||
704705
(isBetaContainer &&
@@ -726,6 +727,7 @@ export const Card = ({
726727
const decideInnerSublinks = () => {
727728
if (!hasSublinks) return null;
728729
if (sublinkPosition !== 'inner') return null;
730+
729731
return (
730732
<Hide until={isFlexSplash ? 'desktop' : 'tablet'}>
731733
<SupportingContent
@@ -1278,7 +1280,7 @@ export const Card = ({
12781280
</Island>
12791281
)}
12801282

1281-
{decideSublinks()}
1283+
{decideOuterSublinks()}
12821284

12831285
{isOpinionCardWithAvatar && (
12841286
<CardFooter

dotcom-rendering/src/components/SupportingContent.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Props = {
1616
alignment: Alignment;
1717
containerPalette?: DCRContainerPalette;
1818
isDynamo?: boolean;
19+
isMedia?: boolean;
1920
/** Allows sublinks container to have a background colour on mobile screen sizes */
2021
fillBackgroundOnMobile?: boolean;
2122
/** Allows sublinks container to have a background colour on desktop screen sizes */
@@ -120,19 +121,23 @@ const wrapperStyles = css`
120121
}
121122
`;
122123

123-
const backgroundFillMobile = css`
124+
const backgroundFillMobile = (isMedia: boolean) => css`
124125
${until.tablet} {
125126
padding: ${space[2]}px;
126127
padding-bottom: ${space[3]}px;
127-
background-color: ${palette('--card-sublinks-background')};
128+
background-color: ${isMedia
129+
? palette('--card-media-sublinks-background')
130+
: palette('--card-sublinks-background')};
128131
}
129132
`;
130133

131-
const backgroundFillDesktop = css`
134+
const backgroundFillDesktop = (isMedia: boolean) => css`
132135
${from.tablet} {
133136
padding: ${space[2]}px;
134137
padding-bottom: ${space[3]}px;
135-
background-color: ${palette('--card-sublinks-background')};
138+
background-color: ${isMedia
139+
? palette('--card-media-sublinks-background')
140+
: palette('--card-sublinks-background')};
136141
}
137142
`;
138143

@@ -141,6 +146,7 @@ export const SupportingContent = ({
141146
alignment,
142147
containerPalette,
143148
isDynamo,
149+
isMedia = false,
144150
fillBackgroundOnMobile = false,
145151
fillBackgroundOnDesktop = false,
146152
}: Props) => {
@@ -153,8 +159,8 @@ export const SupportingContent = ({
153159
wrapperStyles,
154160
baseGrid,
155161
(isDynamo ?? alignment === 'horizontal') && horizontalGrid,
156-
fillBackgroundOnMobile && backgroundFillMobile,
157-
fillBackgroundOnDesktop && backgroundFillDesktop,
162+
fillBackgroundOnMobile && backgroundFillMobile(isMedia),
163+
fillBackgroundOnDesktop && backgroundFillDesktop(isMedia),
158164
]}
159165
>
160166
{supportingContent.map((subLink, index) => {

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5663,6 +5663,11 @@ const cardSublinksBackgroundLight: PaletteFunction = () =>
56635663
const cardSublinksBackgroundDark: PaletteFunction = () =>
56645664
sourcePalette.neutral[10];
56655665

5666+
const cardMediaSublinksBackgroundLight: PaletteFunction = () =>
5667+
sourcePalette.neutral[97];
5668+
const cardMediaSublinksBackgroundDark: PaletteFunction = () =>
5669+
sourcePalette.neutral[20];
5670+
56665671
const latestLinksDottedLineLight: PaletteFunction = () =>
56675672
sourcePalette.neutral[60];
56685673
const latestLinksDottedLineDark: PaletteFunction = () =>
@@ -6122,6 +6127,10 @@ const paletteColours = {
61226127
light: cardMediaIconLight,
61236128
dark: cardMediaIconDark,
61246129
},
6130+
'--card-media-sublinks-background': {
6131+
light: cardMediaSublinksBackgroundLight,
6132+
dark: cardMediaSublinksBackgroundDark,
6133+
},
61256134
'--card-media-waveform': {
61266135
light: cardMediaWaveformLight,
61276136
dark: cardMediaWaveformDark,

0 commit comments

Comments
 (0)