mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Navigation: correctly mark a MegaMenuItem
as active if it has active children (#76944)
correctly mark a MegaMenuItem as active if it has active children
This commit is contained in:
parent
120247667b
commit
f9a89e5cd2
@ -22,8 +22,8 @@ const MAX_DEPTH = 2;
|
||||
|
||||
export function MegaMenuItem({ link, activeItem, level = 0, onClick }: Props) {
|
||||
const FeatureHighlightWrapper = link.highlightText ? FeatureHighlight : React.Fragment;
|
||||
const isActive = link === activeItem;
|
||||
const hasActiveChild = hasChildMatch(link, activeItem);
|
||||
const isActive = link === activeItem || (level === MAX_DEPTH && hasActiveChild);
|
||||
const [sectionExpanded, setSectionExpanded] =
|
||||
useLocalStorage(`grafana.navigation.expanded[${link.text}]`, false) ?? Boolean(hasActiveChild);
|
||||
const showExpandButton = level < MAX_DEPTH && Boolean(linkHasChildren(link) || link.emptyMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user