diff --git a/apps/web/src/components/AccountDrawer/index.tsx b/apps/web/src/components/AccountDrawer/index.tsx index c799a88f14f..d4fa0e85113 100644 --- a/apps/web/src/components/AccountDrawer/index.tsx +++ b/apps/web/src/components/AccountDrawer/index.tsx @@ -1,5 +1,6 @@ import DefaultMenu from 'components/AccountDrawer/DefaultMenu' import { useAccountDrawer } from 'components/AccountDrawer/MiniPortfolio/hooks' +import { Scrim } from 'components/AccountDrawer/Scrim' import { Web3StatusRef } from 'components/Web3Status' import { useAccount } from 'hooks/useAccount' import useDisableScrolling from 'hooks/useDisableScrolling' @@ -8,23 +9,18 @@ import { useOnClickOutside } from 'hooks/useOnClickOutside' import usePrevious from 'hooks/usePrevious' import { useAtom } from 'jotai' import { useEffect, useRef } from 'react' -import { ChevronsRight } from 'react-feather' import { transitions } from 'theme/styles' import { AnimatePresence, Flex, FlexProps, - TouchableArea, WebBottomSheet, styled, useMedia, useScrollbarStyles, useShadowPropsMedium, - useSporeColors, } from 'ui/src' -import { INTERFACE_NAV_HEIGHT, zIndexes } from 'ui/src/theme' -import Trace from 'uniswap/src/features/telemetry/Trace' -import { InterfaceEventName } from 'uniswap/src/features/telemetry/constants' +import { INTERFACE_NAV_HEIGHT, breakpoints, zIndexes } from 'ui/src/theme' import { TestID } from 'uniswap/src/test/fixtures/testIDs' const DRAWER_SPECS = { @@ -57,7 +53,7 @@ const Container = styled(Flex, { '$platform-web': { position: 'fixed' }, top: DRAWER_SPECS.MARGIN, right: '0', - zIndex: zIndexes.dropdown, + zIndex: zIndexes.modal, variants: { open: { true: { right: DRAWER_SPECS.MARGIN }, @@ -95,6 +91,7 @@ const SideDrawerContainer = styled(Flex, { transition: `margin-right ${transitions.duration.medium}`, width: DRAWER_SPECS.WIDTH_XL, maxWidth: DRAWER_SPECS.WIDTH_XL, + zIndex: zIndexes.modal, $xl: { mr: `-${DRAWER_SPECS.WIDTH}`, width: DRAWER_SPECS.WIDTH, @@ -110,23 +107,6 @@ const SideDrawerContainer = styled(Flex, { }, }) -const CloseDrawer = styled(Flex, { - animation: 'fast', - opacity: 0.6, - height: '100%', - p: '$spacing24', - pl: '$spacing12', - pr: `calc(18px + ${DRAWER_SPECS.OFFSET})`, - borderTopLeftRadius: '$rounded20', - borderBottomLeftRadius: '$rounded20', - borderTopRightRadius: '$none', - borderBottomRightRadius: '$none', - '$group-hover': { - x: '$spacing8', - backgroundColor: 'rgba(153,161,189,0.08)', - }, -}) - type AccountDrawerProps = { isOpen: boolean onClose: () => void @@ -164,12 +144,12 @@ function AccountDropdown({ isOpen, onClose, children }: AccountDrawerProps) { } function AccountSideDrawer({ isOpen, onClose, children }: AccountDrawerProps) { - const colors = useSporeColors() const scrollbarStyles = useScrollbarStyles() const accountDrawer = useAccountDrawer() const shadowProps = useShadowPropsMedium() const wasAccountDrawerOpen = usePrevious(accountDrawer.isOpen) const scrollRef = useRef(null) + const drawerRef = useRef(null) useEffect(() => { if (wasAccountDrawerOpen && !accountDrawer.isOpen) { @@ -177,29 +157,28 @@ function AccountSideDrawer({ isOpen, onClose, children }: AccountDrawerProps) { } }, [accountDrawer, wasAccountDrawerOpen]) + useOnClickOutside({ + node: drawerRef, + handler: onClose, + }) + return ( - - {isOpen && ( - - - - - - - - )} - - {/* id used for child InfiniteScrolls to reference when it has reached the bottom of the component */} - - {children} - - - + <> + + + + {/* id used for child InfiniteScrolls to reference when it has reached the bottom of the component */} + + {children} + + + + ) }