Skip to content

Commit 46fd268

Browse files
authored
Left pages nav design changes (#1065)
* Left pages nav design changes * Add hover styling for caret * Fix padding * Move cursor styling to wrapper
1 parent 27f5092 commit 46fd268

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</a>
5959
}
6060

61-
<ul class="block pl-4">
61+
<ul class="block px-4">
6262
@await RenderPartialAsync(_TocTreeNav.Create(new NavigationTreeItem
6363
{
6464
IsPrimaryNavEnabled = Model.IsPrimaryNavEnabled,

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

+24-23
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if (item is FileNavigationItem file && Model.SubTree.IndexFileName != file.File.FileName)
1111
{
1212
var f = file.File;
13-
<li class="flex group/li pr-4 @(isTopLevel ? "font-semibold py-8 pr-4 not-last:border-b-1 border-grey-20" : "ml-5 lg:ml-4 mt-4 lg:mt-3")">
13+
<li class="flex group/li pr-8 @(isTopLevel ? "font-semibold mt-6" : "mt-4")">
1414
<a
1515
href="@f.Url"
1616
@Htmx.GetNavHxAttributes(Model.IsPrimaryNavEnabled && f.NavigationRoot.Id == Model.RootNavigationId || true)
@@ -24,7 +24,7 @@
2424
else if (item is GroupNavigationItem { Group: { NavigationItems.Count: 0, Index: not null } } group)
2525
{
2626
var f = group.Group.Index;
27-
<li class="flex group/li pr-4 @(isTopLevel ? "font-semibold py-8 pr-4 not-last:border-b-1 border-grey-20" : "ml-5 lg:ml-4 mt-4 lg:mt-3")">
27+
<li class="flex group/li pr-4 @(isTopLevel ? "font-semibold mt-6 pr-4" : "ml-4")">
2828
<a
2929
href="@f.Url"
3030
@Htmx.GetNavHxAttributes(Model.IsPrimaryNavEnabled && f.NavigationRoot.Id == Model.RootNavigationId || true)
@@ -38,36 +38,37 @@
3838
else if (item is GroupNavigationItem folder)
3939
{
4040
var g = folder.Group;
41-
<li class="flex flex-wrap group-navigation @(isTopLevel ? "py-8 not-last:border-b-1 border-grey-20 pr-4" : "mt-4 lg:mt-3")">
42-
<div class="peer grid gap-1 @(isTopLevel ? "grid-cols-[1fr_auto] w-full" : "grid-cols-[auto_1fr]")">
43-
<label for="@id" class="group/label flex pt-0.5 @(isTopLevel ? "order-1 items-center mr-3" : "order-0 items-start")">
44-
<svg
45-
xmlns="http://www.w3.org/2000/svg"
46-
fill="none"
47-
viewBox="0 0 24 24"
48-
stroke-width="1.5"
49-
stroke="currentColor"
50-
class="shrink-0 -rotate-90 group-has-checked/label:rotate-0 cursor-pointer @(isTopLevel ? "w-4" : "w-3")">
51-
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
52-
</svg>
53-
<input
54-
id="@id"
55-
type="checkbox"
56-
class="hidden"
57-
aria-hidden="true"
58-
>
59-
</label>
41+
<li class="flex flex-wrap group-navigation @(isTopLevel ? "mt-6" : "mt-4")">
42+
<div class="peer grid grid-cols-[1fr_auto] w-full">
6043
<a
6144
href="@(g.Index?.Url ?? "")"
6245
@Htmx.GetNavHxAttributes(Model.IsPrimaryNavEnabled && g.NavigationRootId == Model.RootNavigationId || true)
6346
id="page-@(g.Index?.Id ?? id)"
64-
class="sidebar-link @(isTopLevel ? "font-semibold font-sans text-base" : "") @(isTopLevel ? "order-0" : "order-1")">
47+
class="sidebar-link pr-2 content-center @(isTopLevel ? "font-semibold" : "")">
6548
@(g.Index?.NavigationTitle ?? (g as TableOfContentsTree)?.Source.ToString() ?? "Untitled")
6649
</a>
50+
<label for="@id" class="group/label flex mr-2 items-start">
51+
<div class="hover:bg-grey-20 rounded-sm p-1 cursor-pointer">
52+
<svg
53+
xmlns="http://www.w3.org/2000/svg"
54+
fill="none"
55+
viewBox="0 0 24 24"
56+
stroke-width="1.5"
57+
stroke="currentColor"
58+
class="shrink-0 -rotate-90 group-has-checked/label:rotate-0 w-3.5">
59+
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
60+
</svg>
61+
</div>
62+
<input
63+
id="@id"
64+
type="checkbox"
65+
class="hidden"
66+
aria-hidden="true">
67+
</label>
6768
</div>
6869
@if (g.NavigationItems.Count > 0)
6970
{
70-
<ul class="w-full hidden peer-has-checked:block @(Model.Level > 0 ? "ml-4": "")">
71+
<ul class="w-full hidden peer-has-checked:block ml-4">
7172
@await RenderPartialAsync(_TocTreeNav.Create(new NavigationTreeItem
7273
{
7374
IsPrimaryNavEnabled = Model.IsPrimaryNavEnabled,

0 commit comments

Comments
 (0)