Skip to content

Commit 391fd02

Browse files
committed
Add dummy data and refactor CTA
1 parent 91f715a commit 391fd02

2 files changed

Lines changed: 61 additions & 23 deletions

File tree

dotcom-rendering/src/components/CallToActionAtom.stories.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { palette as sourcePalette } from '@guardian/source/foundations';
21
import { CallToActionAtom } from './CallToActionAtom';
32

43
export default {
@@ -9,11 +8,10 @@ export default {
98
export const Default = () => {
109
return (
1110
<CallToActionAtom
12-
ctaLinkURL="Link URL"
13-
ctaBackgroundImage="Image URL"
14-
ctaText="This is a call to action"
11+
ctaLinkURL="https://safety.epicgames.com/en-US?lang=en-US"
12+
ctaBackgroundImage="https://media.guim.co.uk/7fe58f11470360bc9f1e4b6bbcbf45d7cf06cfcf/0_0_1300_375/1300.jpg"
13+
ctaText="This is a call to action text"
1514
ctaButtonText="Learn more"
16-
accentColour={sourcePalette.brand[400]}
1715
/>
1816
);
1917
};
Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,85 @@
11
import { css } from '@emotion/react';
2+
import {
3+
from,
4+
palette as sourcePalette,
5+
textSansBold20,
6+
} from '@guardian/source/foundations';
27
import { Button, SvgExternal } from '@guardian/source/react-components';
38

49
type Props = {
510
ctaLinkURL: string;
611
ctaBackgroundImage: string;
712
ctaText: string;
813
ctaButtonText: string;
9-
accentColour: string;
1014
};
1115

1216
export const CallToActionAtom = ({
1317
ctaLinkURL,
1418
ctaBackgroundImage,
1519
ctaText,
1620
ctaButtonText,
17-
accentColour,
1821
}: Props) => {
1922
return (
20-
<div
23+
<a
24+
href={ctaLinkURL}
2125
css={css`
22-
background-image: url(${ctaBackgroundImage});
26+
text-decoration: none;
2327
`}
2428
>
25-
<a
26-
href={ctaLinkURL}
29+
<picture
2730
css={css`
28-
text-decoration: none;
31+
position: relative;
32+
display: flex;
2933
`}
3034
>
31-
<h2>{ctaText}</h2>
32-
<Button
33-
iconSide="right"
34-
size="small"
35-
icon={<SvgExternal />}
36-
cssOverrides={css`
37-
background-color: ${accentColour};
35+
<img
36+
src={ctaBackgroundImage}
37+
alt={
38+
'alt text'
39+
} /* We need alt text here if it is included in the atom data otherwise we need to have a general description */
40+
css={css`
41+
height: 200px;
42+
width: auto
43+
/* This might not be necessary once we have the correct grid in place with article body data */
44+
${from.tablet} {
45+
height: 250px;
46+
}
47+
${from.leftCol} {
48+
height: 375px;
49+
}
50+
`}
51+
/>
52+
<div
53+
css={css`
54+
position: absolute;
55+
bottom: 10%;
56+
left: 10%;
57+
transform: translate(-10%, -10%);
3858
`}
3959
>
40-
{ctaButtonText}
41-
</Button>
42-
</a>
43-
</div>
60+
<h2
61+
css={css`
62+
${textSansBold20}
63+
margin-bottom: 8px;
64+
color: white;
65+
`}
66+
>
67+
{ctaText}
68+
</h2>
69+
<Button
70+
iconSide="right"
71+
size="small"
72+
icon={<SvgExternal />}
73+
theme={{
74+
textPrimary: sourcePalette.neutral[7],
75+
backgroundPrimary: sourcePalette.neutral[97],
76+
backgroundPrimaryHover: sourcePalette.neutral[73],
77+
}}
78+
>
79+
{ctaButtonText}
80+
</Button>
81+
</div>
82+
</picture>
83+
</a>
4484
);
4585
};

0 commit comments

Comments
 (0)