Skip to content

Instantly share code, notes, and snippets.

@rsolari
Last active October 23, 2021 22:18
Show Gist options
  • Save rsolari/5c789aa0bcb9153d93b3d14c2770b8d2 to your computer and use it in GitHub Desktop.
Save rsolari/5c789aa0bcb9153d93b3d14c2770b8d2 to your computer and use it in GitHub Desktop.
// Typescript
import { isMobile, isChrome, isSafari } from "react-device-detect"
// constants
const shouldShowWalletConnect = !(
isMobile &&
isChrome &&
typeof window !== undefined &&
window?.ethereum?.isMetaMask
)
const shouldShowMetaMaskOption = !(
isMobile &&
(isChrome || isSafari) &&
shouldShowWalletConnect
)
{shouldShowMetaMaskOption ? (
<WalletButton
icon={<MetaMaskIcon height={8} width={8} />}
walletName="MetaMask"
onClick={activateMetamask}
/>
) : null}
{shouldShowWalletConnect ? (
<WalletButton
icon={<WalletConnectIcon height={8} width={8} />}
walletName="WalletConnect"
onClick={activateWalletConnect}
/>
) : null}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment