fix: remove radial gradient background effect from nft pages (#5057)
init
This commit is contained in:
parent
ab43800d8e
commit
d3cbcc769c
@ -1,8 +1,10 @@
|
|||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
import { useDarkModeManager } from 'state/user/hooks'
|
import { useDarkModeManager } from 'state/user/hooks'
|
||||||
|
|
||||||
import { SupportedChainId } from '../constants/chains'
|
import { SupportedChainId } from '../constants/chains'
|
||||||
|
import { colorsDark, colorsLight } from './colors'
|
||||||
|
|
||||||
const initialStyles = {
|
const initialStyles = {
|
||||||
width: '200vw',
|
width: '200vw',
|
||||||
@ -27,12 +29,23 @@ const setBackground = (newValues: TargetBackgroundStyles) =>
|
|||||||
export default function RadialGradientByChainUpdater(): null {
|
export default function RadialGradientByChainUpdater(): null {
|
||||||
const { chainId } = useWeb3React()
|
const { chainId } = useWeb3React()
|
||||||
const [darkMode] = useDarkModeManager()
|
const [darkMode] = useDarkModeManager()
|
||||||
|
const { pathname } = useLocation()
|
||||||
|
const isNftPage = pathname.startsWith('/nfts') || pathname.startsWith('/profile')
|
||||||
|
|
||||||
// manage background color
|
// manage background color
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!backgroundRadialGradientElement) {
|
if (!backgroundRadialGradientElement) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNftPage) {
|
||||||
|
setBackground(initialStyles)
|
||||||
|
backgroundRadialGradientElement.style.background = darkMode
|
||||||
|
? colorsDark.backgroundBackdrop
|
||||||
|
: colorsLight.backgroundBackdrop
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch (chainId) {
|
switch (chainId) {
|
||||||
case SupportedChainId.ARBITRUM_ONE:
|
case SupportedChainId.ARBITRUM_ONE:
|
||||||
case SupportedChainId.ARBITRUM_RINKEBY:
|
case SupportedChainId.ARBITRUM_RINKEBY:
|
||||||
@ -77,6 +90,6 @@ export default function RadialGradientByChainUpdater(): null {
|
|||||||
const defaultDarkGradient = 'linear-gradient(180deg, #202738 0%, #070816 100%)'
|
const defaultDarkGradient = 'linear-gradient(180deg, #202738 0%, #070816 100%)'
|
||||||
backgroundRadialGradientElement.style.background = darkMode ? defaultDarkGradient : defaultLightGradient
|
backgroundRadialGradientElement.style.background = darkMode ? defaultDarkGradient : defaultLightGradient
|
||||||
}
|
}
|
||||||
}, [darkMode, chainId])
|
}, [darkMode, chainId, isNftPage])
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user