diff --git a/src/components/NavBar/ChainSelector.css.ts b/src/components/NavBar/ChainSelector.css.ts deleted file mode 100644 index eed1b6c46a..0000000000 --- a/src/components/NavBar/ChainSelector.css.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { style } from '@vanilla-extract/css' -import { lightGrayOverlayOnHover } from 'nft/css/common.css' - -import { sprinkles } from '../../nft/css/sprinkles.css' - -export const ChainSelector = style([ - lightGrayOverlayOnHover, - sprinkles({ - borderRadius: '20', - height: '36', - cursor: 'pointer', - border: 'none', - color: 'neutral1', - background: 'none', - }), -]) diff --git a/src/components/NavBar/ChainSelector.tsx b/src/components/NavBar/ChainSelector.tsx index 59b9c9963c..0a88739e1f 100644 --- a/src/components/NavBar/ChainSelector.tsx +++ b/src/components/NavBar/ChainSelector.tsx @@ -2,6 +2,7 @@ import { t } from '@lingui/macro' import { ChainId } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' import { showTestnetsAtom } from 'components/AccountDrawer/TestnetsToggle' +import { BaseButton } from 'components/Button' import { ChainLogo } from 'components/Logo/ChainLogo' import { MouseoverTooltip } from 'components/Tooltip' import { getConnection } from 'connection' @@ -13,24 +14,38 @@ import { useOnClickOutside } from 'hooks/useOnClickOutside' import useSelectChain from 'hooks/useSelectChain' import useSyncChainQuery from 'hooks/useSyncChainQuery' import { useAtomValue } from 'jotai/utils' -import { Box } from 'nft/components/Box' import { Portal } from 'nft/components/common/Portal' -import { Column, Row } from 'nft/components/Flex' +import { Column } from 'nft/components/Flex' import { useIsMobile } from 'nft/hooks' import { useCallback, useMemo, useRef, useState } from 'react' import { AlertTriangle, ChevronDown, ChevronUp } from 'react-feather' -import { useTheme } from 'styled-components' +import styled, { useTheme } from 'styled-components' import { getSupportedChainIdsFromWalletConnectSession } from 'utils/getSupportedChainIdsFromWalletConnectSession' -import * as styles from './ChainSelector.css' import ChainSelectorRow from './ChainSelectorRow' import { NavDropdown } from './NavDropdown' const NETWORK_SELECTOR_CHAINS = [...L1_CHAIN_IDS, ...L2_CHAIN_IDS] -interface ChainSelectorProps { - leftAlign?: boolean -} +const ChainSelectorWrapper = styled.div` + position: relative; +` + +const ChainSelectorButton = styled(BaseButton)<{ isOpen: boolean }>` + display: flex; + background: ${({ theme, isOpen }) => (isOpen ? theme.accent2 : 'none')}; + padding: 10px 8px; + gap: 4px; + border-radius: 12px; + height: 40px; + color: ${({ theme }) => theme.neutral1}; + transition: ${({ theme }) => + `${theme.transition.duration.medium} ${theme.transition.timing.ease} background-color, ${theme.transition.duration.medium} ${theme.transition.timing.ease} margin`}; + + &:hover { + background-color: ${({ theme }) => theme.deprecated_stateOverlayHover}; + } +` function useWalletSupportedChains(): ChainId[] { const { connector } = useWeb3React() @@ -45,7 +60,7 @@ function useWalletSupportedChains(): ChainId[] { } } -export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => { +export const ChainSelector = ({ leftAlign }: { leftAlign?: boolean }) => { const { chainId } = useWeb3React() const [isOpen, setIsOpen] = useState(false) const isMobile = useIsMobile() @@ -133,25 +148,18 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => { } return ( - + - setIsOpen(!isOpen)} - > + setIsOpen(!isOpen)} isOpen={isOpen}> {!isSupported ? ( ) : ( - + )} {isOpen ? : } - + {isOpen && (isMobile ? {dropdown} : <>{dropdown})} - + ) } diff --git a/src/nft/css/common.css.ts b/src/nft/css/common.css.ts index 94014b12e6..0b5868d1ca 100644 --- a/src/nft/css/common.css.ts +++ b/src/nft/css/common.css.ts @@ -1,6 +1,6 @@ import { style } from '@vanilla-extract/css' -import { sprinkles, vars } from './sprinkles.css' +import { sprinkles } from './sprinkles.css' export const center = sprinkles({ display: 'flex', @@ -58,14 +58,3 @@ export const magicalGradientOnHover = style([ }, }, ]) - -export const lightGrayOverlayOnHover = style([ - sprinkles({ - transition: '250', - }), - { - ':hover': { - background: vars.color.lightGrayOverlay, - }, - }, -])