diff --git a/libs/components/src/navigation/nav-group.stories.ts b/libs/components/src/navigation/nav-group.stories.ts index fc9df19a3e2..d5c381ac3e3 100644 --- a/libs/components/src/navigation/nav-group.stories.ts +++ b/libs/components/src/navigation/nav-group.stories.ts @@ -145,6 +145,9 @@ export const Tree: StoryObj = { + + + diff --git a/libs/components/src/navigation/nav-item.component.html b/libs/components/src/navigation/nav-item.component.html index 9f6ea3373b7..1de8a9bd167 100644 --- a/libs/components/src/navigation/nav-item.component.html +++ b/libs/components/src/navigation/nav-item.component.html @@ -3,10 +3,7 @@ @if (open || icon()) {
@if (open) {
@@ -30,7 +27,7 @@
(false); @@ -52,6 +52,22 @@ export class NavItemComponent extends NavBaseComponent { return this.forceActiveStyles() || (this._isActive && !this.hideActiveStyles()); } + /** + * adding calculation for tree variant due to needing visual alignment on different indentation levels needed between the first level and subsequent levels + */ + protected readonly navItemIndentationPadding = computed(() => { + const open = this.sideNavService.open; + const depth = this.treeDepth() ?? 0; + + if (open && this.variant() === "tree") { + return depth === 1 + ? `${this.TREE_BASE_PADDING}rem` + : `${this.TREE_BASE_PADDING + (depth - 1) * this.TREE_DEPTH_PADDING}rem`; + } + + return `${this.TREE_BASE_PADDING * depth}rem`; + }); + /** * Allow overriding of the RouterLink['ariaCurrentWhenActive'] property. *