Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
fix: z-index bug which prevented modal click (#2264)
Browse files Browse the repository at this point in the history
* 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: Lint Action <lint-action@samuelmeuli.com>
  • Loading branch information
cmcewen and lint-action authored Oct 11, 2021
1 parent 27a868f commit 3e36281
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/swap/UnsupportedCurrencyFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,34 @@ import { AutoRow, RowBetween } from 'components/Row'
import { useActiveWeb3React } from 'hooks/web3'
import { useState } from 'react'
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 { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'

const DetailsFooter = styled.div<{ show: boolean }>`
padding-top: calc(16px + 2rem);
padding-bottom: 20px;
margin-left: auto;
margin-right: auto;
margin-top: -2rem;
width: 100%;
max-width: 400px;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
color: ${({ theme }) => theme.text2};
background-color: ${({ theme }) => theme.advancedBG};
z-index: -1;
z-index: ${Z_INDEX.deprecated_zero};
transform: ${({ show }) => (show ? 'translateY(0%)' : 'translateY(-100%)')};
transition: transform 300ms ease-in-out;
text-align: center;
`

const StyledButtonEmpty = styled(ButtonEmpty)`
text-decoration: none;
`

const AddressText = styled(TYPE.blue)`
font-size: 12px;
Expand Down Expand Up @@ -101,11 +107,11 @@ export default function UnsupportedCurrencyFooter({
</AutoColumn>
</Card>
</Modal>
<ButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}>
<StyledButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}>
<TYPE.blue>
<Trans>Read more about unsupported assets</Trans>
</TYPE.blue>
</ButtonEmpty>
</StyledButtonEmpty>
</DetailsFooter>
)
}
2 changes: 2 additions & 0 deletions src/pages/AppBody.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import styled from 'styled-components/macro'
import { Z_INDEX } from 'theme'

export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>`
position: relative;
Expand All @@ -11,6 +12,7 @@ export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>`
0px 24px 32px rgba(0, 0, 0, 0.01);
border-radius: 24px;
margin-top: 1rem;
z-index: ${Z_INDEX.deprecated_content};
`

/**
Expand Down
15 changes: 15 additions & 0 deletions src/theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ export const MEDIA_WIDTHS = {
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(
(accumulator, size) => {
;(accumulator as any)[size] = (a: any, b: any, c: any) => css`
Expand Down

0 comments on commit 3e36281

Please sign in to comment.