diff --git a/packages/features/shell/navigation/NavigationItem.tsx b/packages/features/shell/navigation/NavigationItem.tsx index a66e1e790a..5d298f03dc 100644 --- a/packages/features/shell/navigation/NavigationItem.tsx +++ b/packages/features/shell/navigation/NavigationItem.tsx @@ -3,6 +3,7 @@ import { usePathname } from "next/navigation"; import React, { Fragment, useState, useEffect } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; +import useMediaQuery from "@calcom/lib/hooks/useMediaQuery"; import classNames from "@calcom/ui/classNames"; import { Icon } from "@calcom/ui/components/icon"; import type { IconName } from "@calcom/ui/components/icon"; @@ -74,6 +75,9 @@ export const NavigationItem: React.FC<{ const shouldDisplayNavigationItem = useShouldDisplayNavigationItem(props.item); const [isExpanded, setIsExpanded] = usePersistedExpansionState(item.name); + const isTablet = useMediaQuery("(max-width: 1024px)"); + const [isTooltipOpen, setIsTooltipOpen] = useState(false); + if (!shouldDisplayNavigationItem) return null; const hasChildren = item.child && item.child.length > 0; @@ -86,13 +90,55 @@ export const NavigationItem: React.FC<{ return ( {isParentNavigationItem ? ( - + + + {t(item.name)} + +
+ {item.child?.map((childItem) => { + const childIsCurrent = + typeof childItem.isCurrent === "function" + ? childItem.isCurrent({ isChild: true, item: childItem, pathname }) + : defaultIsCurrent({ isChild: true, item: childItem, pathname }); + return ( + setIsTooltipOpen(false)} + className={classNames( + "group relative block rounded-md px-3 py-1 text-sm font-medium", + childIsCurrent + ? "bg-emphasis text-white" + : "hover:bg-emphasis text-mute hover:text-emphasis" + )}> + {t(childItem.name)} + + ); + })} +
+ + ) : ( + t(item.name) + ) + } + className="lg:hidden">