WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit cd5c23d

Browse files
rBangayRichard Bangay
andauthored
Support onboarding iframed pages design amends (#3296)
Design amends to the iframed signin, register and passcode pages. Font sizes and spacing; - Headline (h1) responsive font size changes - body copy font size change - spacing between standfirst text and email address input field ## Images Before | After :-------------------------:|:-------------------------: ![](https://github.com/user-attachments/assets/92f6fd8e-d58e-4c3c-bbb3-167196bfc5e6) | ![](https://github.com/user-attachments/assets/95b3f806-2077-4385-beaf-adae9807cb80) --------- Co-authored-by: Richard Bangay <[email protected]>
1 parent 0261b5d commit cd5c23d

File tree

7 files changed

+67
-17
lines changed

7 files changed

+67
-17
lines changed

src/client/components/MainBodyText.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import React, { PropsWithChildren } from 'react';
22
import { css, SerializedStyles } from '@emotion/react';
3-
import { textSans15, textSansBold15 } from '@guardian/source/foundations';
3+
import {
4+
textSans15,
5+
textSans17,
6+
textSansBold15,
7+
textSansBold17,
8+
} from '@guardian/source/foundations';
49

510
interface Props {
611
cssOverrides?: SerializedStyles;
12+
isIframed?: boolean;
713
}
814

915
export const mainBodyTextStyles = css`
@@ -26,9 +32,37 @@ export const mainBodyTextStyles = css`
2632
}
2733
`;
2834

35+
export const iframeMainBodyTextStyles = css`
36+
${textSans17};
37+
color: var(--color-text);
38+
margin: 0;
39+
40+
strong {
41+
${textSansBold17};
42+
color: var(--color-strong-text);
43+
}
44+
45+
a {
46+
${textSansBold17};
47+
color: var(--color-link);
48+
49+
strong {
50+
color: var(--color-link);
51+
}
52+
}
53+
`;
54+
2955
export const MainBodyText = ({
3056
children,
3157
cssOverrides,
58+
isIframed = false,
3259
}: PropsWithChildren<Props>) => (
33-
<p css={[mainBodyTextStyles, cssOverrides]}>{children}</p>
60+
<p
61+
css={[
62+
isIframed ? iframeMainBodyTextStyles : mainBodyTextStyles,
63+
cssOverrides,
64+
]}
65+
>
66+
{children}
67+
</p>
3468
);

src/client/components/MainForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {
4141
import locations from '@/shared/lib/locations';
4242
import { GatewayErrorSummary } from '@/client/components/GatewayErrorSummary';
4343
import { NoScript } from './NoScript';
44+
import { CONTAINER_GAP } from '../models/Style';
4445

4546
type TermsStyle = 'primary' | 'secondary';
4647

@@ -382,6 +383,7 @@ export const MainForm = ({
382383
)}
383384
{recaptchaEnabled && (
384385
<RecaptchaWrapper
386+
overrideGapCounteract={isIframed ? CONTAINER_GAP : undefined}
385387
recaptchaSiteKey={recaptchaSiteKey}
386388
setRecaptchaState={setRecaptchaState}
387389
/>

src/client/layouts/MinimalLayout.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import MinimalHeader from '@/client/components/MinimalHeader';
44
import {
55
from,
66
headlineBold28,
7+
headlineMedium24,
78
headlineMedium28,
89
remSpace,
910
} from '@guardian/source/foundations';
@@ -30,7 +31,6 @@ interface MinimalLayoutProps {
3031
children?: React.ReactNode;
3132
wide?: boolean;
3233
pageHeader: string;
33-
subduedHeadingStyle?: boolean;
3434
leadText?: React.ReactNode;
3535
imageId?: DecorativeImageId;
3636
successOverride?: string;
@@ -66,17 +66,23 @@ const iframeThemeWrapperStyles = css`
6666
gap: ${remSpace[2]};
6767
`;
6868

69-
const pageHeaderStyles = (subduedHeadingStyle: boolean) => css`
69+
const pageHeaderStyles = (amIIframed: boolean) => css`
7070
color: var(--color-heading);
71-
${subduedHeadingStyle ? headlineMedium28 : headlineBold28};
71+
${amIIframed
72+
? `
73+
${headlineMedium24};
74+
${from.mobileLandscape} {
75+
${headlineMedium28};
76+
}
77+
`
78+
: headlineBold28};
7279
margin: 0;
7380
`;
7481

7582
export const MinimalLayout = ({
7683
children,
7784
wide = false,
7885
pageHeader,
79-
subduedHeadingStyle = false,
8086
leadText,
8187
imageId,
8288
successOverride,
@@ -99,7 +105,7 @@ export const MinimalLayout = ({
99105
return <Theme />;
100106
};
101107

102-
const amIIframed = overrideTheme?.includes('iframe');
108+
const amIIframed = !!overrideTheme?.includes('iframe');
103109

104110
const ConditionalIframeThemeWrapper = ({
105111
children,
@@ -121,11 +127,11 @@ export const MinimalLayout = ({
121127
<ConditionalIframeThemeWrapper>
122128
{pageHeader && (
123129
<header>
124-
<h1 css={pageHeaderStyles(subduedHeadingStyle)}>{pageHeader}</h1>
130+
<h1 css={pageHeaderStyles(amIIframed)}>{pageHeader}</h1>
125131
</header>
126132
)}
127133
{leadText && typeof leadText === 'string' ? (
128-
<MainBodyText>{leadText}</MainBodyText>
134+
<MainBodyText isIframed={amIIframed}>{leadText}</MainBodyText>
129135
) : (
130136
leadText
131137
)}

src/client/lib/hooks/useRecaptcha.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ export const RecaptchaWrapper: React.FC<{
187187
setRecaptchaState: React.Dispatch<
188188
React.SetStateAction<UseRecaptchaReturnValue | undefined>
189189
>;
190-
}> = ({ recaptchaSiteKey, setRecaptchaState }) => {
190+
overrideGapCounteract?: number | string;
191+
}> = ({ recaptchaSiteKey, setRecaptchaState, overrideGapCounteract }) => {
191192
const { error, executeCaptcha, expired, requestCount, token, widgetId } =
192193
useRecaptcha(recaptchaSiteKey, 'recaptcha');
193194
React.useEffect(() => {
@@ -208,26 +209,36 @@ export const RecaptchaWrapper: React.FC<{
208209
token,
209210
widgetId,
210211
]);
211-
return <RecaptchaElement id="recaptcha" />;
212+
return (
213+
<RecaptchaElement
214+
id="recaptcha"
215+
gapCountractValue={overrideGapCounteract ?? SECTION_GAP}
216+
/>
217+
);
212218
};
213219

214220
/**
215221
* Provides a standardised way to bind Recaptcha to your page.
216222
*/
223+
interface RecaptchaElementProps extends React.HTMLProps<HTMLDivElement> {
224+
gapCountractValue: number | string;
225+
}
226+
217227
const RecaptchaElement = React.forwardRef<
218228
HTMLDivElement,
219-
React.HTMLProps<HTMLDivElement>
229+
RecaptchaElementProps
220230
>(function RecaptchaElement(props, ref) {
231+
const { gapCountractValue, ...otherProps } = props;
221232
return (
222233
<div
223234
ref={ref}
224235
className="g-recaptcha"
225-
{...props}
236+
{...otherProps}
226237
// TODO: This is a fix for when the reCAPTCHA badge is not visible in the DOM.
227238
// In these cases, the wrapper is still visible, which means it gets affected
228239
// by the `gap` spacing applied to its parent flex container in `MainForm`.
229240
// We set a negative margin here to counteract what looks like an overly large gap.
230-
css={{ marginTop: `-${SECTION_GAP}` }}
241+
css={{ marginTop: `-${gapCountractValue}` }}
231242
></div>
232243
);
233244
});

src/client/pages/IframedPasscodeEmailSent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ export const IframedPasscodeEmailSent = ({
188188
}
189189
pageHeader={text.title}
190190
shortRequestId={shortRequestId}
191-
subduedHeadingStyle={true}
192191
overrideTheme="iframe-light"
193192
>
194193
{email ? (

src/client/pages/IframedRegisterWithEmail.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export const IframedRegisterWithEmail = ({
5858
shortRequestId={shortRequestId}
5959
errorContext={getErrorContext(pageError)}
6060
errorOverride={pageError}
61-
subduedHeadingStyle={true}
6261
overrideTheme="iframe-light"
6362
>
6463
<MainForm

src/client/pages/IframedSignIn.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ export const IframedSignIn = ({
158158
pageHeader="Sign in to your account"
159159
leadText="This unlocks your premium experience, online and in the app."
160160
shortRequestId={shortRequestId}
161-
subduedHeadingStyle={true}
162161
overrideTheme="iframe-light"
163162
>
164163
{/* AuthProviderButtons component with show boolean */}

0 commit comments

Comments
 (0)