Skip to content

Commit ad5a619

Browse files
Update to rollback newslettersignup card we are not going to implement it yet
1 parent e70a571 commit ad5a619

2 files changed

Lines changed: 71 additions & 43 deletions

File tree

dotcom-rendering/src/components/NewsletterSignupCard.tsx

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
headlineMedium20,
55
space,
66
textSans14,
7-
textSans15,
7+
textSansBold15,
88
} from '@guardian/source/foundations';
99
import { SvgNewsletterFilled } from '@guardian/source/react-components';
1010
import { 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 = {
2422
const 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

3028
const dividerStyles = css`
@@ -57,34 +55,64 @@ const titleStyles = css`
5755
const frequencyTagStyles = css`
5856
display: flex;
5957
align-items: center;
58+
gap: 6px;
6059
color: ${themePalette('--newsletter-card-frequency-tag')};
61-
${textSans15};
62-
margin-left: -1px;
63-
margin-top: -1px;
64-
margin-bottom: ${space[1]}px;
60+
${textSansBold15};
61+
margin-bottom: ${space[2]}px;
62+
`;
63+
64+
const frequencyTextStyles = css`
65+
display: 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+
display: flex;
76+
align-items: center;
77+
justify-content: center;
78+
flex-shrink: 0;
79+
width: 24px;
80+
height: 24px;
81+
border-radius: 50%;
82+
background-color: ${themePalette('--newsletter-card-badge-background')};
6583
6684
svg {
67-
fill: currentColor;
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+
border: none;
93+
border-top: 1px solid ${themePalette('--newsletter-card-divider')};
94+
margin: 0 -${space[3]}px ${space[2]}px;
95+
`;
96+
7397
const descriptionStyles = css`
7498
${textSans14};
7599
line-height: 1.15;
76-
margin-bottom: ${space[2]}px;
77100
clear: both;
78101
color: ${themePalette('--newsletter-card-description')};
79102
`;
80103

81104
const illustrationStyles = css`
82105
flex-shrink: 0;
83-
width: 90px;
84-
height: 90px;
106+
width: 70px;
107+
height: 70px;
85108
border-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`
94122
const 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

123156
export 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}

dotcom-rendering/src/components/PuzzlesSupporting.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,9 @@ export const PuzzlesSupporting = ({
302302
illustrationSquare={
303303
newsletter.illustrationSquare
304304
}
305-
illustrationAlt={`${newsletter.name} newsletter illustration`}
306-
hideIllustrationFromScreenReaders={true}
305+
// TODO hide ilustrations when we implement this
306+
// illustrationAlt={`${newsletter.name} newsletter illustration`}
307+
// hideIllustrationFromScreenReaders={true}
307308
isModal={true}
308309
name={newsletter.name}
309310
>

0 commit comments

Comments
 (0)