Commit b2d9814a authored by Max Alekseenko's avatar Max Alekseenko

fix wallet button tooltip

parent 43637f9b
import { Tooltip, useBoolean } from '@chakra-ui/react';
import { Tooltip, useBoolean, useOutsideClick } from '@chakra-ui/react';
import React from 'react';
type Props = {
......@@ -9,6 +9,8 @@ type Props = {
const WalletTooltip = ({ children, isDisabled, isMobile }: Props) => {
const [ isTooltipShown, setIsTooltipShown ] = useBoolean(false);
const ref = React.useRef(null);
useOutsideClick({ ref, handler: setIsTooltipShown.off });
React.useEffect(() => {
const key = `wallet-connect-tooltip-shown-${ isMobile ? 'mobile' : 'desktop' }`;
......@@ -29,6 +31,7 @@ const WalletTooltip = ({ children, isDisabled, isMobile }: Props) => {
isOpen={ isTooltipShown || (isMobile ? false : undefined) }
onClose={ setIsTooltipShown.off }
display={ isMobile ? { base: 'flex', lg: 'none' } : { base: 'none', lg: 'flex' } }
ref={ ref }
>
{ children }
</Tooltip>
......
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