// We do use all the classes in this file currently, but we // index into them with styles[position], which CSS Modules doesn't pick up. // eslint-disable-next-line css-modules/no-unused-class import styles from './Tooltip.module.css' const SIDES = ['top', 'bottom', 'left', 'right'] as const type TopOrBottom = 'top' | 'bottom' type LeftOrRight = 'left' | 'right' type Corner = `${TopOrBottom}-${LeftOrRight}` type TooltipPosition = TopOrBottom | LeftOrRight | Corner interface TooltipProps extends React.PropsWithChildren { position?: TooltipPosition className?: string delay?: number hoverOnly?: boolean } export default function Tooltip({ children, position = 'top', className, delay = 200, hoverOnly = false, }: TooltipProps) { return (
{children}
{SIDES.includes(position as any) ? ( ) : ( )}
) }