Commit 9d3249e6 authored by Connor McEwen's avatar Connor McEwen Committed by GitHub

fix: rendering issues with modal/header (#4636)

* fix overlay issue with modal

* fix z index
parent f1c65afa
...@@ -4,6 +4,7 @@ import React from 'react' ...@@ -4,6 +4,7 @@ import React from 'react'
import { animated, useSpring, useTransition } from 'react-spring' import { animated, useSpring, useTransition } from 'react-spring'
import { useGesture } from 'react-use-gesture' import { useGesture } from 'react-use-gesture'
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { Z_INDEX } from 'theme/zIndex'
import { isMobile } from '../../utils/userAgent' import { isMobile } from '../../utils/userAgent'
...@@ -11,7 +12,7 @@ const AnimatedDialogOverlay = animated(DialogOverlay) ...@@ -11,7 +12,7 @@ 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 }>`
&[data-reach-dialog-overlay] { &[data-reach-dialog-overlay] {
z-index: 2; z-index: ${Z_INDEX.modalBackdrop};
background-color: transparent; background-color: transparent;
overflow: hidden; overflow: hidden;
......
...@@ -4,10 +4,10 @@ import useInterval from 'lib/hooks/useInterval' ...@@ -4,10 +4,10 @@ import useInterval from 'lib/hooks/useInterval'
import React, { useCallback, useMemo, useState } from 'react' import React, { useCallback, useMemo, useState } from 'react'
import { usePopper } from 'react-popper' import { usePopper } from 'react-popper'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Z_INDEX } from 'theme' import { Z_INDEX } from 'theme/zIndex'
const PopoverContainer = styled.div<{ show: boolean }>` const PopoverContainer = styled.div<{ show: boolean }>`
z-index: ${Z_INDEX.absoluteTop}; z-index: ${Z_INDEX.popover};
visibility: ${(props) => (props.show ? 'visible' : 'hidden')}; visibility: ${(props) => (props.show ? 'visible' : 'hidden')};
opacity: ${(props) => (props.show ? 1 : 0)}; opacity: ${(props) => (props.show ? 1 : 0)};
transition: visibility 150ms linear, opacity 150ms linear; transition: visibility 150ms linear, opacity 150ms linear;
......
...@@ -7,7 +7,8 @@ import { useEffect } from 'react' ...@@ -7,7 +7,8 @@ import { useEffect } from 'react'
import { MessageCircle, X } from 'react-feather' import { MessageCircle, X } from 'react-feather'
import { useShowSurveyPopup } from 'state/user/hooks' import { useShowSurveyPopup } from 'state/user/hooks'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { ExternalLink, ThemedText, Z_INDEX } from 'theme' import { ExternalLink, ThemedText } from 'theme'
import { Z_INDEX } from 'theme/zIndex'
import BGImage from '../../assets/images/survey-orb.svg' import BGImage from '../../assets/images/survey-orb.svg'
......
...@@ -10,7 +10,8 @@ import { RoutingDiagramEntry } from 'components/swap/SwapRoute' ...@@ -10,7 +10,8 @@ import { RoutingDiagramEntry } from 'components/swap/SwapRoute'
import { useTokenInfoFromActiveList } from 'hooks/useTokenInfoFromActiveList' import { useTokenInfoFromActiveList } from 'hooks/useTokenInfoFromActiveList'
import { Box } from 'rebass' import { Box } from 'rebass'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText, Z_INDEX } from 'theme' import { ThemedText } from 'theme'
import { Z_INDEX } from 'theme/zIndex'
import { ReactComponent as DotLine } from '../../assets/svg/dot_line.svg' import { ReactComponent as DotLine } from '../../assets/svg/dot_line.svg'
import { MouseoverTooltip } from '../Tooltip' import { MouseoverTooltip } from '../Tooltip'
......
...@@ -5,9 +5,10 @@ import { Twitter } from 'react-feather' ...@@ -5,9 +5,10 @@ import { Twitter } from 'react-feather'
import { useModalIsOpen, useToggleModal } from 'state/application/hooks' import { useModalIsOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer' import { ApplicationModal } from 'state/application/reducer'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { ClickableStyle, CopyHelperRefType, Z_INDEX } from 'theme' import { ClickableStyle, CopyHelperRefType } from 'theme'
import { colors } from 'theme/colors' import { colors } from 'theme/colors'
import { opacify } from 'theme/utils' import { opacify } from 'theme/utils'
import { Z_INDEX } from 'theme/zIndex'
import { ReactComponent as ShareIcon } from '../../../assets/svg/share.svg' import { ReactComponent as ShareIcon } from '../../../assets/svg/share.svg'
import { CopyHelper } from '../../../theme' import { CopyHelper } from '../../../theme'
......
import { useState } from 'react' import { useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Z_INDEX } from 'theme' import { Z_INDEX } from 'theme/zIndex'
import { useModalIsOpen } from '../../state/application/hooks' import { useModalIsOpen } from '../../state/application/hooks'
import { ApplicationModal } from '../../state/application/reducer' import { ApplicationModal } from '../../state/application/reducer'
......
...@@ -9,7 +9,8 @@ import Modal from 'components/Modal' ...@@ -9,7 +9,8 @@ import Modal from 'components/Modal'
import { AutoRow, RowBetween } from 'components/Row' import { AutoRow, RowBetween } from 'components/Row'
import { useState } from 'react' import { useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { CloseIcon, ExternalLink, ThemedText, Z_INDEX } from 'theme' import { CloseIcon, ExternalLink, ThemedText } from 'theme'
import { Z_INDEX } from 'theme/zIndex'
import { useUnsupportedTokens } from '../../hooks/Tokens' import { useUnsupportedTokens } from '../../hooks/Tokens'
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink' import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
......
...@@ -4,7 +4,7 @@ import { ReactNode } from 'react' ...@@ -4,7 +4,7 @@ import { ReactNode } from 'react'
import { AlertTriangle } from 'react-feather' import { AlertTriangle } from 'react-feather'
import { Text } from 'rebass' import { Text } from 'rebass'
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { Z_INDEX } from 'theme' import { Z_INDEX } from 'theme/zIndex'
import { AutoColumn } from '../Column' import { AutoColumn } from '../Column'
......
...@@ -12,8 +12,8 @@ import { lazy, Suspense, useEffect } from 'react' ...@@ -12,8 +12,8 @@ import { lazy, Suspense, useEffect } from 'react'
import { Navigate, Route, Routes, useLocation } from 'react-router-dom' import { Navigate, Route, Routes, useLocation } from 'react-router-dom'
import { useIsDarkMode } from 'state/user/hooks' import { useIsDarkMode } from 'state/user/hooks'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Z_INDEX } from 'theme'
import { SpinnerSVG } from 'theme/components' import { SpinnerSVG } from 'theme/components'
import { Z_INDEX } from 'theme/zIndex'
import { getBrowser } from 'utils/browser' import { getBrowser } from 'utils/browser'
import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals' import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals'
...@@ -74,7 +74,7 @@ const HeaderWrapper = styled.div` ...@@ -74,7 +74,7 @@ const HeaderWrapper = styled.div`
justify-content: space-between; justify-content: space-between;
position: fixed; position: fixed;
top: 0; top: 0;
z-index: ${Z_INDEX.absoluteTop}; z-index: ${Z_INDEX.sticky};
` `
const Marginer = styled.div` const Marginer = styled.div`
......
import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign' import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign'
import React from 'react' import React from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Z_INDEX } from 'theme' import { Z_INDEX } from 'theme/zIndex'
export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string; redesignFlag?: boolean }>` export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string; redesignFlag?: boolean }>`
position: relative; position: relative;
......
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
} from 'react-feather' } from 'react-feather'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import styled, { css, keyframes } from 'styled-components/macro' import styled, { css, keyframes } from 'styled-components/macro'
import { Z_INDEX } from 'theme/zIndex'
import { ReactComponent as TooltipTriangle } from '../assets/svg/tooltip_triangle.svg' import { ReactComponent as TooltipTriangle } from '../assets/svg/tooltip_triangle.svg'
import { anonymizeLink } from '../utils/anonymizeLink' import { anonymizeLink } from '../utils/anonymizeLink'
...@@ -208,8 +209,6 @@ export function ExternalLinkIcon({ ...@@ -208,8 +209,6 @@ export function ExternalLinkIcon({
) )
} }
export const MAX_Z_INDEX = 9999
const ToolTipWrapper = styled.div<{ isCopyContractTooltip?: boolean }>` const ToolTipWrapper = styled.div<{ isCopyContractTooltip?: boolean }>`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -217,7 +216,7 @@ const ToolTipWrapper = styled.div<{ isCopyContractTooltip?: boolean }>` ...@@ -217,7 +216,7 @@ const ToolTipWrapper = styled.div<{ isCopyContractTooltip?: boolean }>`
position: ${({ isCopyContractTooltip }) => (isCopyContractTooltip ? 'relative' : 'absolute')}; position: ${({ isCopyContractTooltip }) => (isCopyContractTooltip ? 'relative' : 'absolute')};
right: ${({ isCopyContractTooltip }) => isCopyContractTooltip && '50%'}; right: ${({ isCopyContractTooltip }) => isCopyContractTooltip && '50%'};
transform: translate(5px, 32px); transform: translate(5px, 32px);
z-index: ${MAX_Z_INDEX}; z-index: ${Z_INDEX.tooltip};
` `
const StyledTooltipTriangle = styled(TooltipTriangle)` const StyledTooltipTriangle = styled(TooltipTriangle)`
......
...@@ -13,7 +13,6 @@ import { darkTheme } from '../nft/themes/darkTheme' ...@@ -13,7 +13,6 @@ import { darkTheme } from '../nft/themes/darkTheme'
import { lightTheme } from '../nft/themes/lightTheme' import { lightTheme } from '../nft/themes/lightTheme'
import { useIsDarkMode } from '../state/user/hooks' import { useIsDarkMode } from '../state/user/hooks'
import { colors as ColorsPalette, colorsDark, colorsLight } from './colors' import { colors as ColorsPalette, colorsDark, colorsLight } from './colors'
import { MAX_Z_INDEX } from './components'
import { AllColors, Colors, ThemeColors } from './styled' import { AllColors, Colors, ThemeColors } from './styled'
import { opacify } from './utils' import { opacify } from './utils'
...@@ -56,22 +55,6 @@ const opacities = { ...@@ -56,22 +55,6 @@ const opacities = {
click: 0.4, click: 0.4,
} }
// Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/
// Please avoid using deprecated numbers
export enum Z_INDEX {
deprecated_zero = 0,
deprecated_content = 1,
dropdown = 1000,
sticky = 1020,
fixed = 1030,
modalBackdrop = 1040,
offcanvas = 1050,
modal = 1060,
popover = 1070,
tooltip = 1080,
absoluteTop = MAX_Z_INDEX,
}
const deprecated_mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } = Object.keys( const deprecated_mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } = Object.keys(
MEDIA_WIDTHS MEDIA_WIDTHS
).reduce((accumulator, size) => { ).reduce((accumulator, size) => {
......
// Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/
// Please avoid using deprecated numbers
export enum Z_INDEX {
deprecated_zero = 0,
deprecated_content = 1,
dropdown = 1000,
sticky = 1020,
fixed = 1030,
modalBackdrop = 1040,
offcanvas = 1050,
modal = 1060,
popover = 1070,
tooltip = 1080,
}
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