tasko/components/hint.tsx

36 lines
725 B
TypeScript
Raw Permalink Normal View History

2024-02-15 02:30:10 +00:00
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
2024-02-16 01:49:19 +00:00
} from '@/components/ui/tooltip';
2024-02-15 02:30:10 +00:00
interface HintProps {
children: React.ReactNode;
description: string;
2024-02-16 01:49:19 +00:00
side?: 'left' | 'right' | 'top' | 'bottom';
2024-02-15 02:30:10 +00:00
sideOffset?: number;
}
export const Hint = ({
children,
description,
2024-02-16 01:49:19 +00:00
side = 'bottom',
2024-02-15 02:30:10 +00:00
sideOffset = 0,
}: HintProps) => {
return (
<TooltipProvider>
<Tooltip delayDuration={0}>
<TooltipTrigger>{children}</TooltipTrigger>
<TooltipContent
sideOffset={sideOffset}
side={side}
2024-02-16 01:49:19 +00:00
className='max-w-[220px] break-words text-xs'
2024-02-15 02:30:10 +00:00
>
{description}
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
};