Skip to content

Commit

Permalink
Merge pull request #1438 from blockscout/fix-wallet-tooltip
Browse files Browse the repository at this point in the history
Fix tooltip for `connect wallet` button
  • Loading branch information
maxaleks authored Dec 25, 2023
2 parents ea9e0cd + b2d9814 commit cc972d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/snippets/walletMenu/WalletTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tooltip, useBoolean } from '@chakra-ui/react';
import { Tooltip, useBoolean, useOutsideClick } from '@chakra-ui/react';
import React from 'react';

type Props = {
Expand All @@ -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' }`;
Expand All @@ -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>
Expand Down

0 comments on commit cc972d2

Please sign in to comment.