FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: z-index bug which prevented modal click (#2264) · differs/interface@3e36281 · GitHub

Repository navigation

Commit 3e36281

Browse files
andauthored
fix: z-index bug which prevented modal click (Uniswap#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: Lint Action <lint-action@samuelmeuli.com>
1 parent 27a868f commit 3e36281

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

‎src/components/swap/UnsupportedCurrencyFooter.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,34 @@ import { AutoRow, RowBetween } from 'components/Row'
99
import { useActiveWeb3React } from 'hooks/web3'
1010
import { useState } from 'react'
1111
import styled from 'styled-components/macro'
12-
import { CloseIcon, ExternalLink, TYPE } from 'theme'
12+
import { CloseIcon, ExternalLink, TYPE, Z_INDEX } from 'theme'
1313

1414
import { useUnsupportedTokens } from '../../hooks/Tokens'
1515
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
1616

1717
const DetailsFooter = styled.div<{ show: boolean }>`
1818
padding-top: calc(16px + 2rem);
1919
padding-bottom: 20px;
20+
margin-left: auto;
21+
margin-right: auto;
2022
margin-top: -2rem;
2123
width: 100%;
2224
max-width: 400px;
2325
border-bottom-left-radius: 20px;
2426
border-bottom-right-radius: 20px;
2527
color: ${({ theme }) => theme.text2};
2628
background-color: ${({ theme }) => theme.advancedBG};
27-
z-index: -1;
29+
z-index: ${Z_INDEX.deprecated_zero};
2830
2931
transform: ${({ show }) => (show ? 'translateY(0%)' : 'translateY(-100%)')};
3032
transition: transform 300ms ease-in-out;
3133
text-align: center;
3234
`
3335

36+
const StyledButtonEmpty = styled(ButtonEmpty)`
37+
text-decoration: none;
38+
`
39+
3440
const AddressText = styled(TYPE.blue)`
3541
font-size: 12px;
3642
@@ -101,11 +107,11 @@ export default function UnsupportedCurrencyFooter({
101107
</AutoColumn>
102108
</Card>
103109
</Modal>
104-
<ButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}>
110+
<StyledButtonEmpty padding={'0'} onClick={() => setShowDetails(true)}>
105111
<TYPE.blue>
106112
<Trans>Read more about unsupported assets</Trans>
107113
</TYPE.blue>
108-
</ButtonEmpty>
114+
</StyledButtonEmpty>
109115
</DetailsFooter>
110116
)
111117
}

‎src/pages/AppBody.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import styled from 'styled-components/macro'
3+
import { Z_INDEX } from 'theme'
34

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

1618
/**

‎src/theme/index.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ export const MEDIA_WIDTHS = {
2121
upToLarge: 1280,
2222
}
2323

24+
// Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/
25+
// Please avoid using deprecated numbers
26+
export enum Z_INDEX {
27+
deprecated_zero = 0,
28+
deprecated_content = 1,
29+
dropdown = 1000,
30+
sticky = 1020,
31+
fixed = 1030,
32+
modalBackdrop = 1040,
33+
offcanvas = 1050,
34+
modal = 1060,
35+
popover = 1070,
36+
tooltip = 1080,
37+
}
38+
2439
const mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } = Object.keys(MEDIA_WIDTHS).reduce(
2540
(accumulator, size) => {
2641
;(accumulator as any)[size] = (a: any, b: any, c: any) => css`

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL