mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(challenge-modal): improve mobile iframe challenge modal positioning and sizing
This commit is contained in:
@@ -145,8 +145,19 @@
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.iframeContainer {
|
||||||
|
width: calc(100% - 10px);
|
||||||
|
max-width: calc(100% - 15px);
|
||||||
|
}
|
||||||
|
|
||||||
.iframeWrapper {
|
.iframeWrapper {
|
||||||
width: 100vw;
|
width: 100%;
|
||||||
height: 70vh;
|
height: 500px;
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iframe {
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,8 +216,10 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isIframeVisible = isIframeChallenge && !showIframeConfirmation;
|
||||||
|
|
||||||
const containerClasses = [styles.container];
|
const containerClasses = [styles.container];
|
||||||
if (isIframeChallenge) {
|
if (isIframeVisible) {
|
||||||
containerClasses.push(styles.iframeContainer);
|
containerClasses.push(styles.iframeContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,13 +248,16 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
const mobileX = isIframeVisible ? 5 : window.innerWidth / 2 - 150;
|
||||||
|
const mobileY = isIframeVisible ? Math.max(10, (window.innerHeight - 600) / 2) : window.innerHeight / 2 - 200;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<animated.div
|
<animated.div
|
||||||
className={containerClasses.join(' ')}
|
className={containerClasses.join(' ')}
|
||||||
ref={nodeRef}
|
ref={nodeRef}
|
||||||
style={{
|
style={{
|
||||||
x: isMobile ? window.innerWidth / 2 - 150 : x,
|
x: isMobile ? mobileX : x,
|
||||||
y: isMobile ? window.innerHeight / 2 - 200 : y,
|
y: isMobile ? mobileY : y,
|
||||||
touchAction: 'none',
|
touchAction: 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user