Skip to content

Commit

Permalink
Disabling onHover and enabling onClick events for NetworkSelector on …
Browse files Browse the repository at this point in the history
…mobile (#503)
  • Loading branch information
alfetopito authored May 3, 2022
1 parent 4324195 commit b99922c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { UnsupportedChainIdError, useWeb3React } from 'web3-react-core'
import { useAddPopup, useRemovePopup } from 'state/application/hooks'
import { useEffect } from 'react'
import { getExplorerBaseUrl } from 'utils/explorer'
import { isMobile } from 'utils/userAgent'

/* const ActiveRowLinkList = styled.div`
display: flex;
Expand Down Expand Up @@ -298,6 +299,10 @@ export default function NetworkSelector() {
const addPopup = useAddPopup()
const removePopup = useRemovePopup()

// mod: When on mobile, disable on hover and enable on click events
const onHoverEvent = () => !isMobile && toggle()
const onClickEvent = () => isMobile && toggle()

useEffect(() => {
const POPUP_KEY = chainId?.toString()

Expand Down Expand Up @@ -391,7 +396,7 @@ export default function NetworkSelector() {
}

return (
<SelectorWrapper ref={node as any} onMouseEnter={toggle} onMouseLeave={toggle}>
<SelectorWrapper ref={node as any} onMouseEnter={onHoverEvent} onMouseLeave={onHoverEvent} onClick={onClickEvent}>
{/*<SelectorControls onClick={conditionalToggle} interactive={showSelector}>
<SelectorLogo interactive={showSelector} src={info.logoUrl || mainnetInfo.logoUrl} />*/}
<SelectorControls interactive>
Expand Down

0 comments on commit b99922c

Please sign in to comment.