Commit 7ba9b1fa authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

fix: don't toggle desktop NetworkSelector on click (#4134)

fix: don't NetworkSelector onClick on desktop
parent 5d43d08f
...@@ -17,6 +17,7 @@ import styled from 'styled-components/macro' ...@@ -17,6 +17,7 @@ import styled from 'styled-components/macro'
import { ExternalLink, MEDIA_WIDTHS } from 'theme' import { ExternalLink, MEDIA_WIDTHS } from 'theme'
import { replaceURLParam } from 'utils/routes' import { replaceURLParam } from 'utils/routes'
import { isChainAllowed, switchChain } from 'utils/switchChain' import { isChainAllowed, switchChain } from 'utils/switchChain'
import { isMobile } from 'utils/userAgent'
const ActiveRowLinkList = styled.div` const ActiveRowLinkList = styled.div`
display: flex; display: flex;
...@@ -120,20 +121,18 @@ const SelectorLabel = styled(NetworkLabel)` ...@@ -120,20 +121,18 @@ const SelectorLabel = styled(NetworkLabel)`
margin-right: 8px; margin-right: 8px;
} }
` `
const SelectorControls = styled.div<{ interactive: boolean }>` const SelectorControls = styled.div`
align-items: center; align-items: center;
background-color: ${({ theme }) => theme.bg0}; background-color: ${({ theme }) => theme.bg0};
border: 2px solid ${({ theme }) => theme.bg0}; border: 2px solid ${({ theme }) => theme.bg0};
border-radius: 16px; border-radius: 16px;
color: ${({ theme }) => theme.text1}; color: ${({ theme }) => theme.text1};
cursor: ${({ interactive }) => (interactive ? 'pointer' : 'auto')};
display: flex; display: flex;
font-weight: 500; font-weight: 500;
justify-content: space-between; justify-content: space-between;
padding: 6px 8px; padding: 6px 8px;
` `
const SelectorLogo = styled(Logo)<{ interactive?: boolean }>` const SelectorLogo = styled(Logo)`
margin-right: ${({ interactive }) => (interactive ? 8 : 0)}px;
@media screen and (min-width: ${MEDIA_WIDTHS.upToSmall}px) { @media screen and (min-width: ${MEDIA_WIDTHS.upToSmall}px) {
margin-right: 8px; margin-right: 8px;
} }
...@@ -338,9 +337,14 @@ export default function NetworkSelector() { ...@@ -338,9 +337,14 @@ export default function NetworkSelector() {
} }
return ( return (
<SelectorWrapper ref={node} onMouseEnter={openModal} onMouseLeave={closeModal} onClick={toggleModal}> <SelectorWrapper
<SelectorControls interactive> ref={node}
<SelectorLogo interactive src={info.logoUrl} /> onMouseEnter={openModal}
onMouseLeave={closeModal}
onClick={isMobile ? toggleModal : undefined}
>
<SelectorControls>
<SelectorLogo src={info.logoUrl} />
<SelectorLabel>{info.label}</SelectorLabel> <SelectorLabel>{info.label}</SelectorLabel>
<StyledChevronDown /> <StyledChevronDown />
</SelectorControls> </SelectorControls>
......
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