Commit d70a87a8 authored by lynn's avatar lynn Committed by GitHub

fix: new swap confirmation modal scroll style (#4768)

* init

* fix in response to cmcewen comment

* top getting cut off fix

* persist change for mobile
parent 2cb0d952
...@@ -10,7 +10,7 @@ import { isMobile } from '../../utils/userAgent' ...@@ -10,7 +10,7 @@ import { isMobile } from '../../utils/userAgent'
const AnimatedDialogOverlay = animated(DialogOverlay) const AnimatedDialogOverlay = animated(DialogOverlay)
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boolean }>` const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boolean; scrollOverlay?: boolean }>`
&[data-reach-dialog-overlay] { &[data-reach-dialog-overlay] {
z-index: ${Z_INDEX.modalBackdrop}; z-index: ${Z_INDEX.modalBackdrop};
background-color: transparent; background-color: transparent;
...@@ -18,6 +18,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boole ...@@ -18,6 +18,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boole
display: flex; display: flex;
align-items: center; align-items: center;
overflow-y: ${({ scrollOverlay }) => scrollOverlay && 'scroll'};
justify-content: center; justify-content: center;
background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundScrim : theme.deprecated_modalBG)}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundScrim : theme.deprecated_modalBG)};
...@@ -27,7 +28,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boole ...@@ -27,7 +28,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boole
const AnimatedDialogContent = animated(DialogContent) const AnimatedDialogContent = animated(DialogContent)
// destructure to not pass custom props to Dialog DOM element // destructure to not pass custom props to Dialog DOM element
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, redesignFlag, ...rest }) => ( const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, redesignFlag, scrollOverlay, ...rest }) => (
<AnimatedDialogContent {...rest} /> <AnimatedDialogContent {...rest} />
)).attrs({ )).attrs({
'aria-label': 'dialog', 'aria-label': 'dialog',
...@@ -35,7 +36,7 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede ...@@ -35,7 +36,7 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede
overflow-y: auto; overflow-y: auto;
&[data-reach-dialog-content] { &[data-reach-dialog-content] {
margin: 0 0 2rem 0; margin: ${({ redesignFlag }) => (redesignFlag ? 'auto' : '0 0 2rem 0')};
background-color: ${({ theme }) => theme.deprecated_bg0}; background-color: ${({ theme }) => theme.deprecated_bg0};
border: 1px solid ${({ theme }) => theme.deprecated_bg1}; border: 1px solid ${({ theme }) => theme.deprecated_bg1};
box-shadow: ${({ theme, redesignFlag }) => box-shadow: ${({ theme, redesignFlag }) =>
...@@ -45,7 +46,7 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede ...@@ -45,7 +46,7 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
align-self: ${({ mobile }) => (mobile ? 'flex-end' : 'center')}; align-self: ${({ mobile }) => mobile && 'flex-end'};
max-width: 420px; max-width: 420px;
${({ maxHeight }) => ${({ maxHeight }) =>
...@@ -58,11 +59,11 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede ...@@ -58,11 +59,11 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, rede
css` css`
min-height: ${minHeight}vh; min-height: ${minHeight}vh;
`} `}
display: flex; display: ${({ scrollOverlay }) => (scrollOverlay ? 'inline-table' : 'flex')};
border-radius: 20px; border-radius: 20px;
${({ theme }) => theme.deprecated_mediaWidth.deprecated_upToMedium` ${({ theme, redesignFlag }) => theme.deprecated_mediaWidth.deprecated_upToMedium`
width: 65vw; width: 65vw;
margin: 0; margin: ${redesignFlag ? 'auto' : '0'};
`} `}
${({ theme, mobile }) => theme.deprecated_mediaWidth.deprecated_upToSmall` ${({ theme, mobile }) => theme.deprecated_mediaWidth.deprecated_upToSmall`
width: 85vw; width: 85vw;
...@@ -87,6 +88,7 @@ interface ModalProps { ...@@ -87,6 +88,7 @@ interface ModalProps {
initialFocusRef?: React.RefObject<any> initialFocusRef?: React.RefObject<any>
children?: React.ReactNode children?: React.ReactNode
redesignFlag?: boolean redesignFlag?: boolean
scrollOverlay?: boolean
} }
export default function Modal({ export default function Modal({
...@@ -97,6 +99,7 @@ export default function Modal({ ...@@ -97,6 +99,7 @@ export default function Modal({
initialFocusRef, initialFocusRef,
children, children,
redesignFlag, redesignFlag,
scrollOverlay,
}: ModalProps) { }: ModalProps) {
const fadeTransition = useTransition(isOpen, { const fadeTransition = useTransition(isOpen, {
config: { duration: 200 }, config: { duration: 200 },
...@@ -129,6 +132,7 @@ export default function Modal({ ...@@ -129,6 +132,7 @@ export default function Modal({
initialFocusRef={initialFocusRef} initialFocusRef={initialFocusRef}
unstable_lockFocusAcrossFrames={false} unstable_lockFocusAcrossFrames={false}
redesignFlag={redesignFlag} redesignFlag={redesignFlag}
scrollOverlay={scrollOverlay}
> >
<StyledDialogContent <StyledDialogContent
{...(isMobile {...(isMobile
...@@ -142,6 +146,7 @@ export default function Modal({ ...@@ -142,6 +146,7 @@ export default function Modal({
maxHeight={maxHeight} maxHeight={maxHeight}
mobile={isMobile} mobile={isMobile}
redesignFlag={redesignFlag} redesignFlag={redesignFlag}
scrollOverlay={scrollOverlay}
> >
{/* prevents the automatic focusing of inputs on mobile by the reach dialog */} {/* prevents the automatic focusing of inputs on mobile by the reach dialog */}
{!initialFocusRef && isMobile ? <div tabIndex={1} /> : null} {!initialFocusRef && isMobile ? <div tabIndex={1} /> : null}
......
...@@ -454,7 +454,7 @@ export default function TransactionConfirmationModal({ ...@@ -454,7 +454,7 @@ export default function TransactionConfirmationModal({
// confirmation screen // confirmation screen
return ( return (
<Modal isOpen={isOpen} onDismiss={onDismiss} maxHeight={90} redesignFlag={redesignFlagEnabled}> <Modal isOpen={isOpen} scrollOverlay={true} onDismiss={onDismiss} maxHeight={90} redesignFlag={redesignFlagEnabled}>
{isL2ChainId(chainId) && (hash || attemptingTxn) ? ( {isL2ChainId(chainId) && (hash || attemptingTxn) ? (
<L2Content chainId={chainId} hash={hash} onDismiss={onDismiss} pendingText={pendingText} /> <L2Content chainId={chainId} hash={hash} onDismiss={onDismiss} pendingText={pendingText} />
) : attemptingTxn ? ( ) : attemptingTxn ? (
......
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