Skip to content

Commit 0a845b7

Browse files
committed
Change main media caption colour text for galleries
1 parent abedcb4 commit 0a845b7

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

dotcom-rendering/src/components/Caption.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ type IconProps = {
3737
format: ArticleFormat;
3838
};
3939

40-
const captionStyle = css`
40+
const captionStyle = (isMainMedia: boolean) => css`
4141
${textSans14};
4242
line-height: 135%;
4343
padding-top: 6px;
4444
overflow-wrap: break-word;
45-
color: ${palette('--caption-text')};
45+
color: ${isMainMedia
46+
? palette('--caption-main-media-text')
47+
: palette('--caption-text')};
4648
`;
4749

4850
const bottomMarginStyles = css`
@@ -303,7 +305,7 @@ export const Caption = ({
303305
const defaultCaption = (
304306
<figcaption
305307
css={[
306-
captionStyle,
308+
captionStyle(isMainMedia),
307309
shouldLimitWidth && limitedWidth,
308310
isOverlaid ? overlaidStyles(format) : bottomMarginStyles,
309311
isMainMedia &&
@@ -352,9 +354,7 @@ export const Caption = ({
352354
*/
353355
line-height: 1.15;
354356
color: ${isMainMedia
355-
? palette(
356-
'--caption-photo-essay-main-media-text',
357-
)
357+
? palette('--caption-main-media-text')
358358
: palette('--caption-text')};
359359
width: 100%;
360360
margin-top: ${space[3]}px;
@@ -365,9 +365,7 @@ export const Caption = ({
365365
padding-top: ${space[2]}px;
366366
border-top: 1px solid
367367
${isMainMedia
368-
? palette(
369-
'--caption-photo-essay-main-media-text',
370-
)
368+
? palette('--caption-main-media-text')
371369
: palette('--caption-text')};
372370
}
373371
`,

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,8 +2738,16 @@ const captionTextDark: PaletteFunction = ({ design, theme }) => {
27382738
}
27392739
};
27402740

2741-
const captionPhotoEssayMainMediaTextLight = () => sourcePalette.neutral[46];
2742-
const captionPhotoEssayMainMediaTextDark = () => sourcePalette.neutral[60];
2741+
const captionMainMediaTextLight: PaletteFunction = ({ design }) => {
2742+
switch (design) {
2743+
case ArticleDesign.Gallery:
2744+
return sourcePalette.neutral[60];
2745+
default:
2746+
return sourcePalette.neutral[46];
2747+
}
2748+
};
2749+
const captionMainMediaTextDark: PaletteFunction = () =>
2750+
sourcePalette.neutral[60];
27432751

27442752
const captionLink: PaletteFunction = ({ design, theme }) => {
27452753
if (design === ArticleDesign.Analysis && theme === Pillar.News) {
@@ -6539,14 +6547,14 @@ const paletteColours = {
65396547
light: captionLink,
65406548
dark: captionLink,
65416549
},
6550+
'--caption-main-media-text': {
6551+
light: captionMainMediaTextLight,
6552+
dark: captionMainMediaTextDark,
6553+
},
65426554
'--caption-overlay-text': {
65436555
light: captionOverlayText,
65446556
dark: captionOverlayText,
65456557
},
6546-
'--caption-photo-essay-main-media-text': {
6547-
light: captionPhotoEssayMainMediaTextLight,
6548-
dark: captionPhotoEssayMainMediaTextDark,
6549-
},
65506558
'--caption-text': {
65516559
light: captionTextLight,
65526560
dark: captionTextDark,

0 commit comments

Comments
 (0)