Skip to content

Commit

Permalink
chore: no idea what i was doing here
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Sep 23, 2024
1 parent 461827b commit f25dd85
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions packages/ui/components/ui/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,10 @@ const NavigationMenuTrigger = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
>(({ className, children, ...props }, ref) => {
const [isHovered, setIsHovered] = React.useState(false);
const timeoutRef = React.useRef<number>();

const handleMouseEnter = () => {
setIsHovered(true);
};

const handleMouseLeave = () => {
timeoutRef.current = setTimeout(() => setIsHovered(false), 1000);
};

const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
if (isHovered) {
e.preventDefault();
} else {
clearTimeout(timeoutRef.current);
}
};

return (
<NavigationMenuPrimitive.Trigger
ref={ref}
className={cn(navigationMenuTriggerStyle(), "group", className)}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
onClick={handleClick}
{...props}
>
{children}
Expand Down

0 comments on commit f25dd85

Please sign in to comment.