From b101157d672b576b62d2faf311f651cd7f2dadd4 Mon Sep 17 00:00:00 2001 From: Vibhor Phalke Date: Mon, 1 Sep 2025 17:21:24 +0530 Subject: [PATCH] fix(navigation): make child nav links accessible on tablet widths (#23138) * fix(navigation): make child links clickable on tab widths * fix(navigation): highlight only active child route & remove underline animation * fix(navigation): onclick single open tooltip and Tailwind color consistency for theme support * Update NavigationItem.tsx * Update Navigation.tsx --------- Co-authored-by: Devanshu Sharma Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- .../shell/navigation/NavigationItem.tsx | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) 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">