Skip to content

Commit 97ca352

Browse files
author
Juarez Mota
committed
fix: z-index and storybook
1 parent f629179 commit 97ca352

File tree

4 files changed

+46
-45
lines changed

4 files changed

+46
-45
lines changed

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

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -264,56 +264,51 @@ signInGateSelectorStoryNoTreatment.storyName =
264264

265265
export const auxiaV2DismissibleModal = () => {
266266
return (
267-
<div id="sign-in-gate">
268-
<Section fullWidth={true}>
269-
<SignInGateSelector
270-
isPaidContent={false}
271-
isPreview={false}
272-
pageId="dismissable-v2"
273-
host="https://www.theguardian.com"
274-
idUrl="https://profile.theguardian.com"
275-
contributionsServiceUrl="https://contributions.guardianapis.com"
276-
signInGateVersion="v2"
277-
auxiaGateDisplayData={{
278-
browserId: 'test-browser-id',
279-
auxiaData: {
280-
responseId: 'test-response-id',
281-
userTreatment:
282-
mockAuxiaResponseDismissible.data.userTreatment,
283-
},
284-
}}
285-
/>
286-
</Section>
287-
</div>
267+
<Section fullWidth={true}>
268+
<SignInGateSelector
269+
isPaidContent={false}
270+
isPreview={false}
271+
pageId="dismissable-v2"
272+
host="https://www.theguardian.com"
273+
idUrl="https://profile.theguardian.com"
274+
contributionsServiceUrl="https://contributions.guardianapis.com"
275+
signInGateVersion="v2"
276+
auxiaGateDisplayData={{
277+
browserId: 'test-browser-id',
278+
auxiaData: {
279+
responseId: 'test-response-id',
280+
userTreatment:
281+
mockAuxiaResponseDismissible.data.userTreatment,
282+
},
283+
}}
284+
/>
285+
</Section>
288286
);
289287
};
290288

291289
auxiaV2DismissibleModal.storyName = 'sign_in_gate_auxia_v2_modal_dismissible';
292290

293291
export const auxiaV2NonDismissibleModal = () => {
294292
return (
295-
<div id="sign-in-gate">
296-
<Section fullWidth={true}>
297-
<SignInGateSelector
298-
isPaidContent={false}
299-
isPreview={false}
300-
pageId="non-dismissable-v2"
301-
host="https://www.theguardian.com"
302-
idUrl="https://profile.theguardian.com"
303-
contributionsServiceUrl="https://contributions.guardianapis.com"
304-
signInGateVersion="v2"
305-
auxiaGateDisplayData={{
306-
browserId: 'test-browser-id',
307-
auxiaData: {
308-
responseId: 'test-response-id',
309-
userTreatment:
310-
mockAuxiaResponseNonDismissible.data
311-
.userTreatment,
312-
},
313-
}}
314-
/>
315-
</Section>
316-
</div>
293+
<Section fullWidth={true}>
294+
<SignInGateSelector
295+
isPaidContent={false}
296+
isPreview={false}
297+
pageId="non-dismissable-v2"
298+
host="https://www.theguardian.com"
299+
idUrl="https://profile.theguardian.com"
300+
contributionsServiceUrl="https://contributions.guardianapis.com"
301+
signInGateVersion="v2"
302+
auxiaGateDisplayData={{
303+
browserId: 'test-browser-id',
304+
auxiaData: {
305+
responseId: 'test-response-id',
306+
userTreatment:
307+
mockAuxiaResponseNonDismissible.data.userTreatment,
308+
},
309+
}}
310+
/>
311+
</Section>
317312
);
318313
};
319314

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from '@guardian/source/foundations';
1515
import { SvgCross, SvgGuardianLogo } from '@guardian/source/react-components';
1616
import { useEffect } from 'react';
17+
import { getZIndex } from '../../../lib/getZIndex';
1718
import { AuthProviderButtons } from '../../AuthProviderButtons/AuthProviderButtons';
1819
import { useConfig } from '../../ConfigContext';
1920
import { ExternalLink } from '../../ExternalLink/ExternalLink';
@@ -297,7 +298,7 @@ const modalOverlay = css`
297298
display: flex;
298299
align-items: center;
299300
justify-content: center;
300-
z-index: 2000;
301+
z-index: ${getZIndex('sign-in-gate')};
301302
padding: ${space[4]}px;
302303
`;
303304

dotcom-rendering/src/components/SignInGateSelector.importable.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ const ShowSignInGateAuxia = ({
477477
logTreatmentInteractionCall,
478478
};
479479

480+
const shouldShowV2Gate: boolean =
481+
typeof process !== 'undefined'
482+
? !!process.env.STORYBOOK
483+
: hasBeenSeen ?? false;
480484
return (
481485
<>
482486
<div
@@ -486,7 +490,7 @@ const ShowSignInGateAuxia = ({
486490
style={{ height: 1, marginTop: -1 }}
487491
/>
488492
{gateVersion === 'v2' ? (
489-
hasBeenSeen && <SignInGateAuxiaV2 {...commonProps} />
493+
shouldShowV2Gate && <SignInGateAuxiaV2 {...commonProps} />
490494
) : (
491495
<SignInGateAuxiaV1 {...commonProps} />
492496
)}

dotcom-rendering/src/lib/getZIndex.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
const indices = [
2525
// Modals will go here at the top
26+
'sign-in-gate',
2627
'lightbox',
2728
'youTubeFullscreen',
2829

0 commit comments

Comments
 (0)