fix(dashboard): Fix styling of nested NavLinks (#9637)

**What**
Adds the `end` prop to NavLinks, so they only use their active style when the current path is a perfect match.
This was added to prevent MenuItems from extensions both showing the parent and child items as active, when the child route was active.

Also added a check to prevent users from adding nested settings NavLinks.


<img width="218" alt="Skærmbillede 2024-10-17 kl  14 25 12" src="https://github.com/user-attachments/assets/9e4d530a-c7b4-410e-aaaf-5a21ac86eb03">
<img width="221" alt="Skærmbillede 2024-10-17 kl  14 24 03" src="https://github.com/user-attachments/assets/6769b951-8e48-4725-a373-dc64ed6936ce">
This commit is contained in:
Kasper Fabricius Kristensen
2024-10-17 16:16:31 +02:00
committed by GitHub
parent e9a06f4b4d
commit b50ac9730e
2 changed files with 17 additions and 4 deletions

View File

@@ -122,6 +122,7 @@ export const NavItem = ({
<NavItemTooltip to={to}>
<NavLink
to={to}
end
state={
from
? {
@@ -167,6 +168,7 @@ export const NavItem = ({
<NavItemTooltip to={to}>
<NavLink
to={to}
end
className={(props) =>
clx(
navLinkClassNames({
@@ -189,6 +191,7 @@ export const NavItem = ({
<NavItemTooltip to={item.to}>
<NavLink
to={item.to}
end
className={(props) =>
clx(
navLinkClassNames({