Show "nav bar item" as active for child routes

This commit is contained in:
schroda
2025-04-05 15:38:13 +02:00
parent 0b97e8bb8d
commit 01cdbd90b8

View File

@@ -43,7 +43,7 @@ const NavigationBarItem = ({ path, title, IconComponent, SelectedIconComponent }
const { isCollapsed } = useNavBarContext(); const { isCollapsed } = useNavBarContext();
const theme = useTheme(); const theme = useTheme();
const isActive = path === location.pathname; const isActive = location.pathname.startsWith(path);
const Icon = isActive ? SelectedIconComponent : IconComponent; const Icon = isActive ? SelectedIconComponent : IconComponent;
const { listItemProps, listItemIconProps } = useMemo( const { listItemProps, listItemIconProps } = useMemo(