44 headlineMedium20 ,
55 space ,
66 textSans14 ,
7- textSans15 ,
7+ textSansBold15 ,
88} from '@guardian/source/foundations' ;
99import { SvgNewsletterFilled } from '@guardian/source/react-components' ;
1010import { palette as themePalette } from '../palette' ;
@@ -14,8 +14,6 @@ export type NewsletterSignupCardProps = {
1414 frequency : string ;
1515 description : string ;
1616 illustrationSquare ?: string ;
17- illustrationAlt ?: string ;
18- hideIllustrationFromScreenReaders ?: boolean ;
1917 children ?: React . ReactNode ;
2018 isSignedIn ?: boolean | 'Pending' ;
2119 isModal ?: boolean ;
@@ -24,7 +22,7 @@ export type NewsletterSignupCardProps = {
2422const containerStyles = css `
2523 clear : left;
2624 background-color : ${ themePalette ( '--newsletter-card-background' ) } ;
27- padding : ${ space [ 3 ] } px ${ space [ 3 ] } px ${ space [ 4 ] } px ${ space [ 3 ] } px;
25+ padding : ${ space [ 2 ] } px ${ space [ 3 ] } px ${ space [ 4 ] } px ${ space [ 3 ] } px;
2826` ;
2927
3028const dividerStyles = css `
@@ -57,34 +55,64 @@ const titleStyles = css`
5755const frequencyTagStyles = css `
5856 dis play: flex;
5957 align- items: center;
58+ gap: 6px;
6059 color : ${ themePalette ( '--newsletter-card-frequency-tag' ) } ;
61- ${ textSans15 } ;
62- margin- left: -1px;
63- margin- to p: -1px;
64- margin- botto m: ${ space [ 1 ] } px;
60+ ${ textSansBold15 } ;
61+ margin- botto m: ${ space [ 2 ] } px;
62+ ` ;
63+
64+ const frequencyTextStyles = css `
65+ dis play: flex;
66+ flex- wrap: wrap;
67+ column- gap: ${ space [ 1 ] } px;
68+ ` ;
69+
70+ const frequencyLabelStyles = css `
71+ white-space: nowrap;
72+ ` ;
73+
74+ const badgeStyles = css `
75+ dis play: flex;
76+ align- items: center;
77+ justify- content: center;
78+ flex- shrink: 0;
79+ width: 24px;
80+ height: 24px;
81+ bor der- radius: 50%;
82+ background- color : ${ themePalette ( '--newsletter-card-badge-background' ) } ;
6583
6684 svg {
67- fill: currentCol or ;
68- height: 20px ;
69- width: 20px ;
85+ fill: ${ themePalette ( '--newsletter-card-badge-icon' ) } ;
86+ height: 18px ;
87+ width: 18px ;
7088 }
7189` ;
7290
91+ const innerDividerStyles = css `
92+ bor der: none;
93+ bor der- to p: 1px solid ${ themePalette ( '--newsletter-card-divider' ) } ;
94+ margin: 0 - ${ space [ 3 ] } px ${ space [ 2 ] } px;
95+ ` ;
96+
7397const descriptionStyles = css `
7498 ${ textSans14 } ;
7599 line-height: 1.15;
76- margin- botto m: ${ space [ 2 ] } px;
77100 clear: both;
78101 color : ${ themePalette ( '--newsletter-card-description' ) } ;
79102` ;
80103
81104const illustrationStyles = css `
82105 flex- shrink: 0;
83- width: 90px ;
84- height: 90px ;
106+ width: 70px ;
107+ height: 70px ;
85108 bor der- radius: 50%;
86109 object- fit: cover;
87110
111+ ${ from . mobileMedium } {
112+ width: 90px;
113+ height: 90px;
114+ }
115+
88116 ${ from . tablet } {
89117 width: 100px;
90118 height: 100px;
@@ -94,39 +122,42 @@ const illustrationStyles = css`
94122const NewsletterSignupHeader = (
95123 props : Omit < NewsletterSignupCardProps , 'children' > ,
96124) => (
97- < div css = { headerStyles } >
98- < div css = { titleAndMetaStyles } >
99- < div css = { frequencyTagStyles } >
125+ < >
126+ < div css = { frequencyTagStyles } >
127+ < span css = { badgeStyles } >
100128 < SvgNewsletterFilled />
101- Free newsletter | { props . frequency }
129+ </ span >
130+ < span css = { frequencyTextStyles } >
131+ < span css = { frequencyLabelStyles } > Free newsletter |</ span >
132+ < span css = { frequencyLabelStyles } > { props . frequency } </ span >
133+ </ span >
134+ </ div >
135+ < hr css = { innerDividerStyles } />
136+ < div css = { headerStyles } >
137+ < div css = { titleAndMetaStyles } >
138+ < p css = { titleStyles } >
139+ Sign up to < span > { props . name } </ span >
140+ </ p >
141+ < p css = { descriptionStyles } > { props . description } </ p >
102142 </ div >
103- < p css = { titleStyles } >
104- Sign up to < span > { props . name } </ span >
105- </ p >
106- < p css = { descriptionStyles } > { props . description } </ p >
143+ { ! ! props . illustrationSquare && (
144+ < img
145+ css = { illustrationStyles }
146+ src = { props . illustrationSquare }
147+ alt = ""
148+ loading = "lazy"
149+ decoding = "async"
150+ />
151+ ) }
107152 </ div >
108- { ! ! props . illustrationSquare && (
109- < img
110- css = { illustrationStyles }
111- src = { props . illustrationSquare }
112- alt = { props . illustrationAlt ?? '' }
113- aria-hidden = {
114- props . hideIllustrationFromScreenReaders || undefined
115- }
116- loading = "lazy"
117- decoding = "async"
118- />
119- ) }
120- </ div >
153+ </ >
121154) ;
122155
123156export const NewsletterSignupCard = ( {
124157 name,
125158 frequency,
126159 description,
127160 illustrationSquare,
128- illustrationAlt,
129- hideIllustrationFromScreenReaders,
130161 children,
131162 isSignedIn,
132163 isModal = false ,
@@ -138,10 +169,6 @@ export const NewsletterSignupCard = ({
138169 name = { name }
139170 description = { description }
140171 illustrationSquare = { illustrationSquare }
141- illustrationAlt = { illustrationAlt }
142- hideIllustrationFromScreenReaders = {
143- hideIllustrationFromScreenReaders
144- }
145172 isSignedIn = { isSignedIn }
146173 />
147174 { children }
0 commit comments