Commit 30d1de8e authored by eddie's avatar eddie Committed by GitHub

fix: moonpay modal height (#6439)

parent 0e5328be
import { getTestSelector } from '../utils'
describe('Buy Crypto Modal', () => {
it('should open and close', () => {
cy.visit('/')
// Open the fiat onramp modal
cy.get(getTestSelector('buy-fiat-button')).click()
cy.get(getTestSelector('fiat-onramp-modal')).should('be.visible')
// Click on a location that should be outside the modal, which should close it
cy.get('body').click(0, 100)
cy.get(getTestSelector('fiat-onramp-modal')).should('not.exist')
})
it('should open and close, mobile viewport', () => {
cy.viewport('iphone-6')
cy.visit('/')
// Open the fiat onramp modal
cy.get(getTestSelector('buy-fiat-button')).click()
cy.get(getTestSelector('fiat-onramp-modal')).should('be.visible')
// Click on a location that should be outside the modal, which should close it
cy.get('body').click(10, 10)
cy.get(getTestSelector('fiat-onramp-modal')).should('not.exist')
})
})
...@@ -19,7 +19,7 @@ const Wrapper = styled.div<{ isDarkMode: boolean }>` ...@@ -19,7 +19,7 @@ const Wrapper = styled.div<{ isDarkMode: boolean }>`
display: flex; display: flex;
flex-flow: column nowrap; flex-flow: column nowrap;
margin: 0; margin: 0;
min-height: 720px; flex: 1 1;
min-width: 375px; min-width: 375px;
position: relative; position: relative;
width: 100%; width: 100%;
...@@ -125,7 +125,7 @@ export default function FiatOnrampModal() { ...@@ -125,7 +125,7 @@ export default function FiatOnrampModal() {
}, [fetchSignedIframeUrl]) }, [fetchSignedIframeUrl])
return ( return (
<Modal isOpen={fiatOnrampModalOpen} onDismiss={closeModal} maxHeight={720}> <Modal isOpen={fiatOnrampModalOpen} onDismiss={closeModal} height={80 /* vh */}>
<Wrapper data-testid="fiat-onramp-modal" isDarkMode={isDarkMode}> <Wrapper data-testid="fiat-onramp-modal" isDarkMode={isDarkMode}>
{error ? ( {error ? (
<> <>
......
...@@ -79,6 +79,7 @@ interface ModalProps { ...@@ -79,6 +79,7 @@ interface ModalProps {
isOpen: boolean isOpen: boolean
onDismiss?: () => void onDismiss?: () => void
onSwipe?: () => void onSwipe?: () => void
height?: number // takes precedence over minHeight and maxHeight
minHeight?: number | false minHeight?: number | false
maxHeight?: number maxHeight?: number
maxWidth?: number maxWidth?: number
...@@ -94,6 +95,7 @@ export default function Modal({ ...@@ -94,6 +95,7 @@ export default function Modal({
minHeight = false, minHeight = false,
maxHeight = 90, maxHeight = 90,
maxWidth = 420, maxWidth = 420,
height,
initialFocusRef, initialFocusRef,
children, children,
onSwipe = onDismiss, onSwipe = onDismiss,
...@@ -139,8 +141,8 @@ export default function Modal({ ...@@ -139,8 +141,8 @@ export default function Modal({
} }
: {})} : {})}
aria-label="dialog" aria-label="dialog"
$minHeight={minHeight} $minHeight={height ?? minHeight}
$maxHeight={maxHeight} $maxHeight={height ?? maxHeight}
$scrollOverlay={$scrollOverlay} $scrollOverlay={$scrollOverlay}
$hideBorder={hideBorder} $hideBorder={hideBorder}
$maxWidth={maxWidth} $maxWidth={maxWidth}
......
...@@ -105,7 +105,7 @@ export default memo(function CurrencySearchModal({ ...@@ -105,7 +105,7 @@ export default memo(function CurrencySearchModal({
break break
} }
return ( return (
<Modal isOpen={isOpen} onDismiss={onDismiss} maxHeight={modalHeight} minHeight={modalHeight}> <Modal isOpen={isOpen} onDismiss={onDismiss} height={modalHeight}>
{content} {content}
</Modal> </Modal>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment