Skip to content

Commit ebb87c6

Browse files
authored
Merge branch 'main' into link-follow-to-notifications
2 parents 0ce18c3 + 0c26d7c commit ebb87c6

2 files changed

Lines changed: 31 additions & 14 deletions

File tree

dotcom-rendering/src/components/marketing/banners/designableBanner/v2/components/BannerBody.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { from, space, textSans15 } from '@guardian/source/foundations';
33
import { createBannerBodyCopy } from '../../components/BannerText';
44
import type { BannerData } from '../BannerProps';
55

6-
const getStyles = (textColour: string, highlightColour?: string) => ({
6+
const getStyles = (
7+
highlightedTextColour: string,
8+
highlightColour?: string,
9+
) => ({
710
container: css`
811
margin-bottom: ${space[4]}px;
912
@@ -24,7 +27,7 @@ const getStyles = (textColour: string, highlightColour?: string) => ({
2427
`,
2528
highlightedText: css`
2629
display: inline;
27-
color: ${textColour};
30+
color: ${highlightedTextColour};
2831
2932
${highlightColour
3033
? `
@@ -41,11 +44,12 @@ export const BannerBody = ({
4144
}: {
4245
bannerData: BannerData;
4346
}): JSX.Element | null => {
44-
const textColour = bannerData.settings.containerSettings.textColor ?? '';
47+
const highlightedTextColour =
48+
bannerData.settings.highlightedTextSettings.textColour ?? '';
4549
const highlightColour =
4650
bannerData.settings.highlightedTextSettings.highlightColour;
4751

48-
const styles = getStyles(textColour, highlightColour);
52+
const styles = getStyles(highlightedTextColour, highlightColour);
4953
const { copyForViewport, showBody } = bannerData.selectors;
5054

5155
return (

dotcom-rendering/src/components/marketing/shared/ThreeTierChoiceCards.tsx

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ const supportingTextStyles = css`
6767
const SupportingBenefits = ({
6868
benefitsLabel,
6969
benefits,
70+
benefitsTickColour,
7071
choiceCardDesignSettings,
7172
}: {
7273
benefitsLabel?: string;
7374
benefits: ChoiceCard['benefits'];
75+
benefitsTickColour?: string;
7476
choiceCardDesignSettings?: ChoiceCardDesignSettings;
7577
}) => {
7678
const showTicks = benefits.length > 1;
@@ -94,6 +96,7 @@ const SupportingBenefits = ({
9496
size="xsmall"
9597
theme={{
9698
fill:
99+
benefitsTickColour ??
97100
choiceCardDesignSettings?.buttonSelectMarkerColour ??
98101
palette.brand[400],
99102
}}
@@ -187,16 +190,19 @@ export const ThreeTierChoiceCards = ({
187190
palette.brand[400],
188191
};
189192

193+
const getPillBackgroundColour = (
194+
pill: NonNullable<ChoiceCard['pill']>,
195+
): string => {
196+
if (choiceCardDesignSettings?.pillBackgroundColour) {
197+
return choiceCardDesignSettings.pillBackgroundColour;
198+
}
199+
if (pill.backgroundColour) {
200+
return hexColourToString(pill.backgroundColour as HexColour);
201+
}
202+
return palette.brandAlt[400];
203+
};
204+
190205
const pillStyles = (pill: NonNullable<ChoiceCard['pill']>) => {
191-
const buildBackgroundColour = (): string => {
192-
if (choiceCardDesignSettings?.pillBackgroundColour) {
193-
return choiceCardDesignSettings.pillBackgroundColour;
194-
}
195-
if (pill.backgroundColour) {
196-
return hexColourToString(pill.backgroundColour as HexColour);
197-
}
198-
return palette.brandAlt[400];
199-
};
200206
const buildTextColour = (): string => {
201207
if (choiceCardDesignSettings?.pillTextColour) {
202208
return choiceCardDesignSettings.pillTextColour;
@@ -210,7 +216,7 @@ export const ThreeTierChoiceCards = ({
210216
return css`
211217
border-radius: 4px;
212218
padding: ${space[1]}px ${space[2]}px;
213-
background-color: ${buildBackgroundColour()};
219+
background-color: ${getPillBackgroundColour(pill)};
214220
${textSansBold14};
215221
color: ${buildTextColour()};
216222
position: absolute;
@@ -343,6 +349,13 @@ export const ThreeTierChoiceCards = ({
343349
| undefined
344350
}
345351
benefits={benefits}
352+
benefitsTickColour={
353+
pill
354+
? getPillBackgroundColour(
355+
pill,
356+
)
357+
: undefined
358+
}
346359
choiceCardDesignSettings={
347360
choiceCardDesignSettings
348361
}

0 commit comments

Comments
 (0)