'use client' import { useState } from 'react' import { Transition } from '@headlessui/react' type TooltipProps = { children: React.ReactNode className?: string position?: string } export default function Tooltip({ children, className = '', position = 'top', }: TooltipProps) { const [tooltipOpen, setTooltipOpen] = useState(false) const positionOuterClasses = (position: string) => { switch (position) { case 'right': return 'left-full top-1/2 transform -translate-y-1/2' case 'left': return 'right-full top-1/2 transform -translate-y-1/2' case 'bottom': return 'top-full left-1/2 transform -translate-x-1/2' default: return 'bottom-full left-1/2 transform -translate-x-1/2' } } const positionInnerClasses = (position: string) => { switch (position) { case 'right': return 'ml-2' case 'left': return 'mr-2' case 'bottom': return 'mt-2' default: return 'mb-2' } } return (
setTooltipOpen(true)} onMouseLeave={() => setTooltipOpen(false)} onFocus={() => setTooltipOpen(true)} onBlur={() => setTooltipOpen(false)} >
{children}
) }