Skip to content

Commit 234bd0d

Browse files
committed
simplify navigation if using tag groups
1 parent addf375 commit 234bd0d

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

src/Elastic.ApiExplorer/Landing/LandingNavigationItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public LandingNavigationItem(string url)
5252
}
5353

5454
/// <inheritdoc />
55-
public bool IsUsingNavigationDropdown => NavigationItems.OfType<ClassificationNavigationItem>().Any();
55+
public bool IsUsingNavigationDropdown => false;
5656
}
5757

5858
public interface IApiGroupingNavigationItem<out TGroupingModel, out TNavigationItem> : INodeNavigationItem<TGroupingModel, TNavigationItem>
@@ -106,7 +106,7 @@ public class ClassificationNavigationItem(ApiClassification classification, Land
106106
public override string Id { get; } = ShortId.Create(classification.Name);
107107

108108
/// <inheritdoc />
109-
public bool IsUsingNavigationDropdown => true;
109+
public bool IsUsingNavigationDropdown => false;
110110
}
111111

112112
public class TagNavigationItem(ApiTag tag, IRootNavigationItem<IApiGroupingModel, INavigationItem> rootNavigation, INodeNavigationItem<INavigationModel, INavigationItem> parent)

src/Elastic.ApiExplorer/Landing/LandingView.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
}
8383
<section id="elastic-docs-v3">
8484
<h1>@Model.ApiInfo.Title</h1>
85-
<p>@Model.ApiInfo.Description</p>
85+
<p>@Model.RenderMarkdown(Model.ApiInfo.Description)</p>
8686
<p>License: @Model.ApiInfo.License?.Name</p>
8787
<div class="api-overview">
8888
<table>

src/Elastic.Documentation.Site/Navigation/_TocTree.cshtml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@
66
var currentTopLevelItem = Model.TopLevelItems.FirstOrDefault(i => i.Id == Model.Tree.Id) ?? Model.Tree;
77
}
88
@if (Model.IsUsingNavigationDropdown && currentTopLevelItem is { Index: not null })
9-
{
10-
<div class="sticky top-0 py-6 bg-white z-10 border-b-1 border-grey-20 pr-4">
11-
<div tabindex="0" id="pages-dropdown" class="block group border-1 border-grey-20 rounded-sm font-sans relative">
12-
<button class="w-full text-left grid grid-cols-[1fr_auto] cursor-pointer font-semibold gap-1 hover:text-black pl-4 pr-2 py-2 group-open:border-b-1 border-grey-20">
13-
<div>
14-
<a
15-
class="pages-dropdown_active hover:underline text-blue-elastic hover:text-blue-elastic-100"
16-
href="@currentTopLevelItem.Url"
17-
@Htmx.GetNavHxAttributes(true)>
18-
@currentTopLevelItem.NavigationTitle
19-
</a>
20-
</div>
21-
<div class="flex items-center justify-center size-6 hover:bg-grey-20 rounded-sm">
22-
<svg
23-
xmlns="http://www.w3.org/2000/svg"
24-
fill="none"
25-
viewBox="0 0 24 24"
26-
stroke-width="1.5"
27-
stroke="currentColor"
28-
class="w-4 group-open:rotate-180">
29-
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
30-
</svg>
31-
</div>
32-
</button>
9+
{
10+
<div class="sticky top-0 py-6 bg-white z-10 border-b-1 border-grey-20 pr-4">
11+
<div tabindex="0" id="pages-dropdown" class="block group border-1 border-grey-20 rounded-sm font-sans relative">
12+
<button class="w-full text-left grid grid-cols-[1fr_auto] cursor-pointer font-semibold gap-1 hover:text-black pl-4 pr-2 py-2 group-open:border-b-1 border-grey-20">
13+
<div>
14+
<a
15+
class="pages-dropdown_active hover:underline text-blue-elastic hover:text-blue-elastic-100"
16+
href="@currentTopLevelItem.Url"
17+
@Htmx.GetNavHxAttributes(true)>
18+
@currentTopLevelItem.NavigationTitle
19+
</a>
20+
</div>
21+
<div class="flex items-center justify-center size-6 hover:bg-grey-20 rounded-sm">
22+
<svg
23+
xmlns="http://www.w3.org/2000/svg"
24+
fill="none"
25+
viewBox="0 0 24 24"
26+
stroke-width="1.5"
27+
stroke="currentColor"
28+
class="w-4 group-open:rotate-180">
29+
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
30+
</svg>
31+
</div>
32+
</button>
3333
<div class="hidden group-focus-within:block left-0 right-0 absolute top-full">
3434
<ul class="mt-1 py-2 bg-white border-1 border-grey-20 rounded-sm shadow-md">
35-
@foreach (var item in Model.TopLevelItems)
36-
{
35+
@foreach (var item in Model.TopLevelItems)
36+
{
3737
<li class="block">
3838
<a
3939
class="block py-2 px-4 hover:underline hover:text-black hover:bg-grey-10 active:bg-blue-elastic-70 active:text-white font-semibold @(item.NavigationRoot.Id == Model.Tree.Id ? "text-blue-elastic" : "")"
4040
href="@item.Url"
4141
@Htmx.GetNavHxAttributes(false, "mouseover")>
42-
@item.NavigationTitle
43-
</a>
44-
</li>
45-
}
46-
</ul>
42+
@item.NavigationTitle
43+
</a>
44+
</li>
45+
}
46+
</ul>
4747
</div>
4848
</div>
4949
</div>
@@ -57,16 +57,16 @@
5757
@Model.Title
5858
</a>
5959
}
60-
61-
<ul class="block px-4">
62-
@await RenderPartialAsync(_TocTreeNav.Create(new NavigationTreeItem
63-
{
64-
IsPrimaryNavEnabled = Model.IsPrimaryNavEnabled,
65-
IsGlobalAssemblyBuild = Model.IsGlobalAssemblyBuild,
66-
Level = 0,
67-
SubTree = Model.Tree,
68-
RootNavigationId = Model.Tree.Id,
69-
MaxLevel = Model.MaxLevel
70-
}))
71-
</ul>
60+
61+
<ul class="block px-4">
62+
@await RenderPartialAsync(_TocTreeNav.Create(new NavigationTreeItem
63+
{
64+
IsPrimaryNavEnabled = Model.IsPrimaryNavEnabled,
65+
IsGlobalAssemblyBuild = Model.IsGlobalAssemblyBuild,
66+
Level = 0,
67+
SubTree = Model.Tree,
68+
RootNavigationId = Model.Tree.Id,
69+
MaxLevel = Model.MaxLevel
70+
}))
71+
</ul>
7272
</div>

0 commit comments

Comments
 (0)