From 8374be074b80b9ea43faadca9fd0356767ae8c0f Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Thu, 15 May 2025 18:51:33 +0200 Subject: [PATCH] Update navbar-popover-item.tsx --- .../common-header/navbar-popover-item.tsx | 203 +++++++++--------- 1 file changed, 106 insertions(+), 97 deletions(-) diff --git a/website/src/refine-theme/common-header/navbar-popover-item.tsx b/website/src/refine-theme/common-header/navbar-popover-item.tsx index 206a4e07..91f0309f 100644 --- a/website/src/refine-theme/common-header/navbar-popover-item.tsx +++ b/website/src/refine-theme/common-header/navbar-popover-item.tsx @@ -4,111 +4,120 @@ import { Popover, Transition } from "@headlessui/react"; import clsx from "clsx"; import { ChevronDownIcon } from "../icons/chevron-down"; -import { NavbarPopoverItemType } from "./constants"; +import type { NavbarPopoverItemType } from "./constants"; import { PointIcon } from "../icons/popover"; type NavbarPopoverItemProps = { - item: NavbarPopoverItemType; + item: NavbarPopoverItemType; + variant?: "landing" | "blog"; }; export const NavbarPopoverItem: React.FC = ({ - item, - children, + item, + variant = "landing", + children, }) => { - const [isShowing, setIsShowing] = useState(false); - const timeoutRef = React.useRef(null); - const timeoutEnterRef = React.useRef(null); - const location = useLocation(); + const [isShowing, setIsShowing] = useState(false); + const timeoutRef = React.useRef(null); + const timeoutEnterRef = React.useRef(null); + const location = useLocation(); - React.useEffect(() => { - setIsShowing(false); - }, [location]); + React.useEffect(() => { + setIsShowing(false); + }, [location]); - return ( - { - timeoutEnterRef.current = setTimeout( - () => setIsShowing(true), - 210, - ); - clearTimeout(timeoutRef.current); - }} - onMouseLeave={() => { - timeoutRef.current = setTimeout(() => setIsShowing(false), 210); - clearTimeout(timeoutEnterRef.current); - }} - > - {() => ( - <> - - - {item.label} - - - - - -
- {children} -
-
-
- + return ( + { + timeoutEnterRef.current = setTimeout(() => setIsShowing(true), 210); + clearTimeout(timeoutRef.current); + }} + onMouseLeave={() => { + timeoutRef.current = setTimeout(() => setIsShowing(false), 210); + clearTimeout(timeoutEnterRef.current); + }} + > + {() => ( + <> + - ); + > + + {item.label} + + + + + +
+ {children} +
+
+
+ + )} +
+ ); };