Commit 3e36281f authored by Connor McEwen's avatar Connor McEwen Committed by GitHub

fix: z-index bug which prevented modal click (#2264)

* Fix z-index bug which prevented modal click. Center button and remove underline

* Fix code style issues with ESLint

* fix: PR comments

* Fix code style issues with ESLint

* z-index comment

* Fix code style issues with ESLint
Co-authored-by: default avatarLint Action <lint-action@samuelmeuli.com>
parent 27a868f0
...@@ -9,7 +9,7 @@ import { AutoRow, RowBetween } from 'components/Row' ...@@ -9,7 +9,7 @@ import { AutoRow, RowBetween } from 'components/Row'
import { useActiveWeb3React } from 'hooks/web3' import { useActiveWeb3React } from 'hooks/web3'
import { useState } from 'react' import { useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { CloseIcon, ExternalLink, TYPE } from 'theme' import { CloseIcon, ExternalLink, TYPE, Z_INDEX } from 'theme'
import { useUnsupportedTokens } from '../../hooks/Tokens' import { useUnsupportedTokens } from '../../hooks/Tokens'
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink' import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
...@@ -17,6 +17,8 @@ import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink' ...@@ -17,6 +17,8 @@ import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
const DetailsFooter = styled.div<{ show: boolean }>` const DetailsFooter = styled.div<{ show: boolean }>`
padding-top: calc(16px + 2rem); padding-top: calc(16px + 2rem);
padding-bottom: 20px; padding-bottom: 20px;
margin-left: auto;
margin-right: auto;
margin-top: -2rem; margin-top: -2rem;
width: 100%; width: 100%;
max-width: 400px; max-width: 400px;
...@@ -24,13 +26,17 @@ const DetailsFooter = styled.div<{ show: boolean }>` ...@@ -24,13 +26,17 @@ const DetailsFooter = styled.div<{ show: boolean }>`
border-bottom-right-radius: 20px; border-bottom-right-radius: 20px;
color: ${({ theme }) => theme.text2}; color: ${({ theme }) => theme.text2};
background-color: ${({ theme }) => theme.advancedBG}; background-color: ${({ theme }) => theme.advancedBG};
z-index: -1; z-index: ${Z_INDEX.deprecated_zero};
transform: ${({ show }) => (show ? 'translateY(0%)' : 'translateY(-100%)')}; transform: ${({ show }) => (show ? 'translateY(0%)' : 'translateY(-100%)')};
transition: transform 300ms ease-in-out; transition: transform 300ms ease-in-out;
text-align: center; text-align: center;
` `
const StyledButtonEmpty = styled(ButtonEmpty)`
text-decoration: none;
`
const AddressText = styled(TYPE.blue)` const AddressText = styled(TYPE.blue)`
font-size: 12px; font-size: 12px;
...@@ -101,11 +107,11 @@ export default function UnsupportedCurrencyFooter({ ...@@ -101,11 +107,11 @@ export default function UnsupportedCurrencyFooter({
</AutoColumn> </AutoColumn>
</Card> </Card>
</Modal> </Modal>
<ButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}> <StyledButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}>
<TYPE.blue> <TYPE.blue>
<Trans>Read more about unsupported assets</Trans> <Trans>Read more about unsupported assets</Trans>
</TYPE.blue> </TYPE.blue>
</ButtonEmpty> </StyledButtonEmpty>
</DetailsFooter> </DetailsFooter>
) )
} }
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'
export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>` export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>`
position: relative; position: relative;
...@@ -11,6 +12,7 @@ export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>` ...@@ -11,6 +12,7 @@ export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>`
0px 24px 32px rgba(0, 0, 0, 0.01); 0px 24px 32px rgba(0, 0, 0, 0.01);
border-radius: 24px; border-radius: 24px;
margin-top: 1rem; margin-top: 1rem;
z-index: ${Z_INDEX.deprecated_content};
` `
/** /**
......
...@@ -21,6 +21,21 @@ export const MEDIA_WIDTHS = { ...@@ -21,6 +21,21 @@ export const MEDIA_WIDTHS = {
upToLarge: 1280, upToLarge: 1280,
} }
// 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,
}
const mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } = Object.keys(MEDIA_WIDTHS).reduce( const mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } = Object.keys(MEDIA_WIDTHS).reduce(
(accumulator, size) => { (accumulator, size) => {
;(accumulator as any)[size] = (a: any, b: any, c: any) => css` ;(accumulator as any)[size] = (a: any, b: any, c: any) => css`
......
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