Skip to content

Commit 4a28465

Browse files
author
Juarez Mota
committed
feat: sign-in gate v2 non-dismissable
1 parent 217ea26 commit 4a28465

File tree

3 files changed

+132
-4
lines changed

3 files changed

+132
-4
lines changed

dotcom-rendering/src/components/AuthProviderButtons/AuthProviderButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
} from '@guardian/source/react-components';
1414
import React from 'react';
1515
import { buildUrlWithQueryParams } from '../../lib/routeUtils';
16+
import type { AuxiaGateVersion } from '../SignInGate/types';
1617
import type { IsNativeApp, QueryParams } from './types';
17-
import { AuxiaGateVersion } from '../SignInGate/types';
1818

1919
type AuthButtonProvider = 'social' | 'email';
2020

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

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export const signInGateSelectorStoryNoTreatment = () => {
268268
signInGateSelectorStoryNoTreatment.storyName =
269269
'sign_in_gate_selector_no_treatment';
270270

271-
export const auxiaV2Modal = () => {
271+
export const auxiaV2DismissibleModal = () => {
272272
const mockUserTreatment: AuxiaAPIResponseDataUserTreatment = {
273273
treatmentId: 'test-treatment-id',
274274
treatmentTrackingId: 'test-tracking-id',
@@ -314,4 +314,54 @@ export const auxiaV2Modal = () => {
314314
);
315315
};
316316

317-
auxiaV2Modal.storyName = 'sign_in_gate_auxia_v2_modal_dismissable';
317+
auxiaV2DismissibleModal.storyName = 'sign_in_gate_auxia_v2_modal_dismissible';
318+
319+
export const auxiaV2NonDismissibleModal = () => {
320+
const mockUserTreatment: AuxiaAPIResponseDataUserTreatment = {
321+
treatmentId: 'test-treatment-id',
322+
treatmentTrackingId: 'test-tracking-id',
323+
surface: 'test-surface',
324+
treatmentContent: JSON.stringify({
325+
title: 'Sorry for the interruption. We believe in free, independent journalism for all. Sign in or register to keep reading.',
326+
subtitle:
327+
"Once you are signed in, we'll bring you back here shortly.",
328+
body: '',
329+
first_cta_name: 'Create account',
330+
first_cta_link: 'https://profile.theguardian.com/register',
331+
second_cta_name: '',
332+
}),
333+
rank: '1',
334+
contentLanguageCode: 'en',
335+
treatmentType: 'test-type',
336+
};
337+
338+
return (
339+
<Section fullWidth={true}>
340+
<SignInGateAuxiaV2
341+
signInUrl="https://profile.theguardian.com/signin"
342+
dismissGate={() => console.log('Gate dismissed')}
343+
abTest={{
344+
name: 'AuxiaSignInGate',
345+
variant: 'test-variant',
346+
id: 'test-id',
347+
}}
348+
ophanComponentId="test-component-id"
349+
userTreatment={mockUserTreatment}
350+
logTreatmentInteractionCall={async (
351+
interactionType,
352+
actionName,
353+
) => {
354+
console.log(
355+
'Treatment interaction:',
356+
interactionType,
357+
actionName,
358+
);
359+
}}
360+
guUrl="https://www.theguardian.com/"
361+
/>
362+
</Section>
363+
);
364+
};
365+
366+
auxiaV2NonDismissibleModal.storyName =
367+
'sign_in_gate_auxia_v2_modal_non_dismissible';

dotcom-rendering/src/components/SignInGate/gateDesigns/SignInGateAuxiaV2.tsx

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { css } from '@emotion/react';
22
import {
33
from,
4+
headlineMedium20,
45
headlineMedium28,
56
headlineMedium34,
67
headlineMedium42,
@@ -106,13 +107,21 @@ export const SignInGateAuxiaV2 = ({
106107
return (
107108
<div
108109
css={modalOverlay}
110+
className={dismissStatusLabel}
109111
onClick={handleBackdropClick}
110112
data-testid="sign-in-gate-modal-overlay"
111113
>
112114
<div css={modalContainer} data-testid="sign-in-gate-main">
113115
<div css={topContainer}>
114116
<div css={topBar}>
115-
<SvgGuardianLogo textColor="#041F4A" width={96} />
117+
<SvgGuardianLogo
118+
textColor={
119+
isDismissible
120+
? palette.brand[300]
121+
: palette.neutral[100]
122+
}
123+
width={96}
124+
/>
116125

117126
{isDismissible && (
118127
<button
@@ -302,6 +311,11 @@ const modalContainer = css`
302311
flex-direction: row;
303312
gap: 0;
304313
}
314+
315+
.non-dismissible & {
316+
gap: 0;
317+
padding: 0;
318+
}
305319
`;
306320

307321
// --- New Layout Containers ---
@@ -314,12 +328,33 @@ const topContainer = css`
314328
padding: ${space[4]}px;
315329
}
316330
331+
${from.desktop} {
332+
border-bottom: 0.5px solid ${palette.brand[400]};
333+
padding: ${space[4]}px;
334+
}
335+
317336
${from.desktop} {
318337
border-bottom: 0;
319338
border-right: 0.5px solid ${palette.brand[400]};
320339
flex-direction: column-reverse;
321340
gap: ${space[8]}px;
322341
}
342+
343+
.non-dismissible & {
344+
background: ${palette.brand[400]};
345+
padding: ${space[3]}px;
346+
347+
${from.phablet} {
348+
border: 0;
349+
padding: ${space[4]}px;
350+
}
351+
352+
${from.desktop} {
353+
border: 0;
354+
max-width: 470px;
355+
padding: ${space[6]}px ${space[4]}px ${space[4]}px ${space[8]}px;
356+
}
357+
}
323358
`;
324359

325360
const contentContainer = css`
@@ -336,6 +371,18 @@ const contentContainer = css`
336371
gap: ${space[6]}px;
337372
padding: ${space[6]}px ${space[10]}px;
338373
}
374+
375+
.non-dismissible & {
376+
padding: ${space[3]}px;
377+
378+
${from.phablet} {
379+
padding: ${space[4]}px;
380+
}
381+
382+
${from.desktop} {
383+
padding: ${space[6]}px ${space[10]}px;
384+
}
385+
}
339386
`;
340387

341388
const headerSection = css`
@@ -371,6 +418,9 @@ const headerImage = css`
371418
align-self: center;
372419
width: 280px;
373420
}
421+
.non-dismissible & {
422+
display: none;
423+
}
374424
`;
375425

376426
const actionsSection = css`
@@ -402,6 +452,15 @@ const signInTopBar = css`
402452
${headlineMedium34};
403453
}
404454
}
455+
456+
.non-dismissible & {
457+
${from.desktop} {
458+
h2 {
459+
${headlineMedium34};
460+
color: ${palette.brand[400]};
461+
}
462+
}
463+
}
405464
`;
406465

407466
const dismissButtonStyles = css`
@@ -442,6 +501,21 @@ const subHeadingStyles = css`
442501
${headlineMedium42};
443502
padding: 0;
444503
}
504+
505+
.non-dismissible & {
506+
${headlineMedium20};
507+
color: ${palette.neutral[100]};
508+
509+
${from.phablet} {
510+
${headlineMedium28};
511+
padding: ${space[1]}px 0 0;
512+
}
513+
514+
${from.desktop} {
515+
${headlineMedium42};
516+
padding: 0;
517+
}
518+
}
445519
`;
446520

447521
const descriptionText = css`
@@ -455,6 +529,10 @@ const descriptionText = css`
455529
${from.desktop} {
456530
${textSans17};
457531
}
532+
533+
.non-dismissible & {
534+
color: ${palette.neutral[100]};
535+
}
458536
`;
459537

460538
const socialContainer = css`

0 commit comments

Comments
 (0)