diff --git a/components/Header/index.tsx b/components/Header/index.tsx index e3afba00..2d67c65f 100644 --- a/components/Header/index.tsx +++ b/components/Header/index.tsx @@ -57,11 +57,25 @@ const HelpMenuItem = () => { }; const CommunityItem = () => { const [isHovered, setIsHovered] = useState(false); + const [timeoutId, setTimeoutId] = useState(null); const isMobile = isMobileDevice(); + + const handleMouseLeave = () => { + const id = setTimeout(() => setIsHovered(false), 300); + setTimeoutId(id); + }; + + const handleMouseEnter = () => { + if (timeoutId) { + clearTimeout(timeoutId); + } + setIsHovered(true); + }; + return (
setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} + onMouseEnter={handleMouseEnter} + onMouseLeave={handleMouseLeave} className="inline-block py-3 px-2 cursor-pointer hover:bg-gray-800 hover:border hover:border-dark-50 relative rounded-md" >