Skip to content

Commit bae6593

Browse files
committed
Enhance
1 parent fab693e commit bae6593

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
{
1010
var f = file.File;
1111
var isCurrent = f == Model.CurrentDocument;
12-
<li class="block ml-2 pl-2 w-full border-l-1 group @(isCurrent ? "current border-l-gray-200" : "border-l-gray-200")">
12+
<li class="block ml-2 pl-2 w-full border-l-1 border-l-gray-200 group/li @(isCurrent ? "current" : string.Empty)">
1313
<div class="flex">
1414
<div class="w-5">
1515
</div>
1616
<a
17-
class="block py-1 text-sm leading-[1.2em] tracking-[-0.02em] group-[.current]:text-blue-elastic! hover:text-ink-dark"
18-
href="@f.Url">
17+
class="block py-1 text-sm leading-[1.2em] tracking-[-0.02em] group-[.current]/li:text-blue-elastic! hover:text-ink-dark @(isCurrent ? "pointer-events-none" : string.Empty)"
18+
href="@f.Url"
19+
@(isCurrent ? "aria-current=page" : string.Empty)
20+
>
1921
@f.NavigationTitle
2022
</a>
2123
</div>
@@ -30,14 +32,14 @@
3032
var containsCurrent = g.HoldsCurrent(Model.CurrentDocument) || g.ContainsCurrentPage(Model.CurrentDocument);
3133
var shouldInitiallyExpand = containsCurrent || g.Depth <= initialExpandLevel;
3234
<li class="flex flex-wrap ml-2 pl-2 @(g.Depth > 1 ? "border-l-1 border-l-gray-200" : string.Empty)">
33-
<label for="@slug" class="peer group flex items-center mr-1">
35+
<label for="@slug" class="peer group/label flex items-center mr-1">
3436
<svg
3537
xmlns="http://www.w3.org/2000/svg"
3638
fill="none"
3739
viewBox="0 0 24 24"
3840
stroke-width="1.5"
3941
stroke="currentColor"
40-
class="w-4 shrink -rotate-90 group-has-checked:rotate-0 cursor-pointer">
42+
class="w-4 shrink -rotate-90 group-has-checked/label:rotate-0 cursor-pointer">
4143
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
4244
</svg>
4345
<input
@@ -46,13 +48,14 @@
4648
class="hidden"
4749
aria-hidden="true"
4850
data-should-expand="@containsCurrent.ToLowerString()"
49-
@(shouldInitiallyExpand ? "checked" : string.Empty)>
51+
@(shouldInitiallyExpand ? "checked" : string.Empty)
52+
>
53+
<a
54+
href="@g.Index?.Url"
55+
class="block py-1 text-sm leading-[1.2em] tracking-[-0.02em] hover:text-ink-dark @(containsCurrent ? "font-semibold" : string.Empty) @(isCurrent ? "current pointer-events-none text-blue-elastic!" : string.Empty)">
56+
@g.Index?.NavigationTitle
57+
</a>
5058
</label>
51-
<a
52-
href="@g.Index?.Url"
53-
class="block py-1 text-sm leading-[1.2em] tracking-[-0.02em] hover:text-ink-dark @(containsCurrent && g.Depth == 1 ? "font-bold" : string.Empty) @(isCurrent ? "current text-blue-elastic!" : string.Empty) ">
54-
@g.Index?.NavigationTitle
55-
</a>
5659
@if (g.NavigationItems.Count > 0)
5760
{
5861
<ul class="h-0 grow overflow-hidden peer-has-checked:h-auto w-full overflow-hidden" data-has-current="@g.ContainsCurrentPage(Model.CurrentDocument)">

0 commit comments

Comments
 (0)