Skip to content

Commit c2f0902

Browse files
authored
Fix pages navigation appearance (#787)
* Fix pages navigation appearance * Use `IsPrimaryNavEnabled` instead of passing `isRoot`
1 parent c3e1240 commit c2f0902

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

src/Elastic.Markdown/Slices/HtmlWriter.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,11 @@ private NavigationViewModel CreateNavigationModel(INavigation navigation)
4949
if (navigation is not DocumentationGroup tree)
5050
throw new InvalidOperationException("Expected a documentation group");
5151

52-
var isRoot = navigation.Id == tree.Id;
53-
5452
return new NavigationViewModel
5553
{
5654
Title = tree.Index?.NavigationTitle ?? "Docs",
5755
TitleUrl = tree.Index?.Url ?? Set.Build.UrlPathPrefix ?? "/",
5856
Tree = tree,
59-
IsRoot = isRoot,
6057
IsPrimaryNavEnabled = Set.Configuration.Features.IsPrimaryNavEnabled,
6158
TopLevelItems = Set.Tree.NavigationItems.OfType<GroupNavigation>().ToList()
6259
};

src/Elastic.Markdown/Slices/Layout/_TocTree.cshtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
Level = Model.Tree.Depth,
6161
SubTree = Model.Tree,
6262
RootNavigationId = Model.Tree.Id,
63-
IsRoot = Model.IsRoot
6463
}))
6564
</ul>
6665
</div>

src/Elastic.Markdown/Slices/Layout/_TocTreeNav.cshtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
@using Elastic.Markdown.IO.Navigation
33
@inherits RazorSlice<NavigationTreeItem>
44
@{
5-
var topLevelGroup = Model.IsRoot ? 1 : 2;
6-
var topLevelFile = Model.IsRoot ? 0 : 1;
5+
var topLevelGroup = Model.IsPrimaryNavEnabled ? 2 : 1;
6+
var topLevelFile = Model.IsPrimaryNavEnabled ? 1 : 0;
77
}
88
@foreach (var item in Model.SubTree.NavigationItems)
99
{
@@ -66,7 +66,6 @@
6666
IsPrimaryNavEnabled = Model.IsPrimaryNavEnabled,
6767
Level = g.Depth,
6868
SubTree = g,
69-
IsRoot = Model.IsRoot,
7069
RootNavigationId = Model.RootNavigationId
7170
}))
7271
</ul>

src/Elastic.Markdown/Slices/_ViewModels.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ public class NavigationViewModel
9898
public required string TitleUrl { get; init; }
9999
public required INavigation Tree { get; init; }
100100
//public required MarkdownFile CurrentDocument { get; init; }
101-
public required bool IsRoot { get; init; }
102101
public required bool IsPrimaryNavEnabled { get; init; }
103-
104102
public required IEnumerable<GroupNavigation> TopLevelItems { get; init; }
105103
}
106104

@@ -109,7 +107,6 @@ public class NavigationTreeItem
109107
public required int Level { get; init; }
110108
//public required MarkdownFile CurrentDocument { get; init; }
111109
public required INavigation SubTree { get; init; }
112-
public required bool IsRoot { get; init; }
113110
public required bool IsPrimaryNavEnabled { get; init; }
114111
public required string RootNavigationId { get; set; }
115112
}

0 commit comments

Comments
 (0)