import Tippy, { TippyProps } from '@tippyjs/react' import classNames from 'classnames' import { ReactNode } from 'react' import { Questionmark } from 'components/common/Icons' import TooltipContent from 'components/common/Tooltip/TooltipContent' import { DEFAULT_SETTINGS } from 'constants/defaultSettings' import { LocalStorageKeys } from 'constants/localStorageKeys' import useLocalStorage from 'hooks/localStorage/useLocalStorage' interface Props extends TippyProps { content: ReactNode | string type: TooltipType className?: string delay?: number interactive?: boolean underline?: boolean hideArrow?: boolean contentClassName?: string placement?: 'top' | 'bottom' | 'left' | 'right' } export const Tooltip = (props: Props) => { const [reduceMotion] = useLocalStorage( LocalStorageKeys.REDUCE_MOTION, DEFAULT_SETTINGS.reduceMotion, ) const isInWalletAssetModal = document.getElementById('wallet-assets-modal') const isInModal = document.getElementById('modal') return ( isInWalletAssetModal ?? isInModal ?? document.body} interactive={props.interactive} animation={false} delay={[props.delay ?? 0, 0]} placement={props.placement ?? 'top'} render={() => ( )} onClickOutside={props.onClickOutside} visible={props.visible} > {props.children ? (
{props.children}
) : ( )}
) }