import cx from 'clsx'; import { ReactNode, useRef, useState } from 'react'; import { CSSTransition } from 'react-transition-group'; import styles from './Tooltip.module.css'; interface TooltipProps { content: ReactNode; position?: 'top' | 'bottom' | 'left' | 'right'; children?: ReactNode; } const positionMap = { top: styles.top, bottom: styles.bottom, left: styles.left, right: styles.right, }; export function Tooltip({ content, position = 'top', children }: TooltipProps) { const [show, setShow] = useState(false); const contentRef = useRef(); return (
setShow(true)} onMouseLeave={() => setShow(false)}> {children}
{content}
); }