This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/src/components/ui/tooltip.tsx

31 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-09-11 23:10:16 +01:00
"use client";
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import * as React from "react";
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
import { cn } from "@/common/utils";
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
const TooltipProvider = TooltipPrimitive.Provider;
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
const Tooltip = TooltipPrimitive.Root;
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
const TooltipTrigger = TooltipPrimitive.Trigger;
2024-09-08 22:35:32 +01:00
const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2024-09-13 13:45:04 +01:00
className,
2024-09-08 22:35:32 +01:00
)}
{...props}
/>
2024-09-11 23:10:16 +01:00
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
2024-09-08 22:35:32 +01:00
2024-09-11 23:10:16 +01:00
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };