Skip to content

Commit 0947c41

Browse files
committed
Add accent colour to CTA button
1 parent 56d6b75 commit 0947c41

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

dotcom-rendering/src/components/CallToActionAtom.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type CallToActionProps = {
1414
backgroundImage?: string;
1515
text?: string;
1616
buttonText?: string;
17+
accentColour?: string;
1718
};
1819

1920
const overlayMaskGradientStyles = (angle: string, startPosition: number) => {
@@ -116,6 +117,7 @@ export const CallToActionAtom = ({
116117
backgroundImage,
117118
text,
118119
buttonText,
120+
accentColour,
119121
}: CallToActionProps) => {
120122
return (
121123
<a
@@ -153,9 +155,17 @@ export const CallToActionAtom = ({
153155
size="small"
154156
icon={<SvgExternal />}
155157
theme={{
156-
textPrimary: sourcePalette.neutral[7],
157-
backgroundPrimary: sourcePalette.neutral[100],
158-
backgroundPrimaryHover: sourcePalette.neutral[86],
158+
// We also still need to implement the dark mode based on the provided designs which should be the same as not providing an accent colour.
159+
textPrimary: accentColour
160+
? sourcePalette.neutral[100]
161+
: sourcePalette.neutral[0],
162+
backgroundPrimary:
163+
accentColour ?? sourcePalette.neutral[100],
164+
//This is temporary as the behaviour we have in PROD is a lightbox when hover over the CTA.
165+
backgroundPrimaryHover: transparentColour(
166+
accentColour ?? sourcePalette.neutral[100],
167+
0.8,
168+
),
159169
}}
160170
>
161171
{buttonText}

dotcom-rendering/src/layouts/HostedArticleLayout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ export const HostedArticleLayout = (props: WebProps | AppProps) => {
350350
backgroundImage={cta.image}
351351
text={cta.label}
352352
buttonText={cta.btnText}
353+
accentColour={
354+
branding?.hostedCampaignColour
355+
}
353356
/>
354357
</div>
355358
)}

0 commit comments

Comments
 (0)