Skip to content

Commit 76e0732

Browse files
committed
fix(challenge-modal): improve mobile iframe challenge modal positioning and sizing
1 parent a7dc46f commit 76e0732

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/components/challenge-modal/challenge-modal.module.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,19 @@
145145
cursor: default;
146146
}
147147

148+
.iframeContainer {
149+
width: calc(100% - 10px);
150+
max-width: calc(100% - 15px);
151+
}
152+
148153
.iframeWrapper {
149-
width: 100vw;
150-
height: 70vh;
154+
width: 100%;
155+
height: 500px;
156+
margin: 5px 0;
157+
}
158+
159+
.iframe {
160+
border-left: none;
161+
border-right: none;
151162
}
152163
}

src/components/challenge-modal/challenge-modal.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
216216
return null;
217217
}
218218

219+
const isIframeVisible = isIframeChallenge && !showIframeConfirmation;
220+
219221
const containerClasses = [styles.container];
220-
if (isIframeChallenge) {
222+
if (isIframeVisible) {
221223
containerClasses.push(styles.iframeContainer);
222224
}
223225

@@ -246,13 +248,16 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
246248
}
247249
})();
248250

251+
const mobileX = isIframeVisible ? 5 : window.innerWidth / 2 - 150;
252+
const mobileY = isIframeVisible ? Math.max(10, (window.innerHeight - 600) / 2) : window.innerHeight / 2 - 200;
253+
249254
return (
250255
<animated.div
251256
className={containerClasses.join(' ')}
252257
ref={nodeRef}
253258
style={{
254-
x: isMobile ? window.innerWidth / 2 - 150 : x,
255-
y: isMobile ? window.innerHeight / 2 - 200 : y,
259+
x: isMobile ? mobileX : x,
260+
y: isMobile ? mobileY : y,
256261
touchAction: 'none',
257262
}}
258263
>

0 commit comments

Comments
 (0)