|
| 1 | +@using Elastic.Markdown.Helpers |
1 | 2 | @using Elastic.Markdown.IO.Navigation |
2 | 3 | @inherits RazorSlice<NavigationTreeItem> |
3 | 4 | @if (Model.IsRedesign) |
|
8 | 9 | { |
9 | 10 | var f = file.File; |
10 | 11 | var isCurrent = f == Model.CurrentDocument; |
11 | | - <li class="block pl-6 pb-2 w-full @(isCurrent ? "current" : string.Empty)"> |
| 12 | + <li class="block pl-4 w-full @(isCurrent ? "current" : string.Empty)"> |
12 | 13 | <div class="flex"> |
13 | 14 | <div class="w-6"> |
14 | 15 | </div> |
15 | 16 | <a |
16 | | - class="block w-full hover:font-bold @(isCurrent ? "font-bold text-blue-elastic" : string.Empty) " |
| 17 | + class="block py-1 w-full hover:font-bold @(isCurrent ? "font-bold text-blue-elastic" : string.Empty) " |
17 | 18 | href="@f.Url"> |
18 | 19 | @f.NavigationTitle |
19 | 20 | </a> |
20 | 21 | </div> |
21 | | - |
22 | 22 | </li> |
23 | 23 | } |
24 | 24 | else if (item is GroupNavigation folder) |
25 | 25 | { |
26 | 26 | var g = folder.Group; |
27 | 27 | var isCurrent = g.Index == Model.CurrentDocument; |
| 28 | + var slug = g.Index?.Title.Slugify(); |
28 | 29 | const int initialExpandLevel = 1; |
29 | 30 | var shouldExpand = g.HoldsCurrent(Model.CurrentDocument) || g.Depth <= initialExpandLevel || g.ContainsCurrentPage(Model.CurrentDocument); |
30 | | - <li class="block pl-6 pb-2"> |
31 | | - <div class="flex items-center"> |
32 | | - <div class="w-6"> |
33 | | - @if (g.NavigationItems.Count > 0) |
34 | | - { |
35 | | - <label for="@g.Index?.Title"> |
36 | | - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 cursor-pointer"> |
37 | | - <path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/> |
38 | | - </svg> |
39 | | - </label> |
40 | | - } |
41 | | - </div> |
42 | | - <a |
43 | | - href="@g.Index?.Url" |
44 | | - class="block w-full hover:font-bold @(isCurrent ? "font-bold text-blue-elastic" : string.Empty) "> |
45 | | - @g.Index?.NavigationTitle |
46 | | - </a> |
47 | | - </div> |
48 | | - <input |
49 | | - id="@g.Index?.Title" |
50 | | - type="checkbox" |
51 | | - class="peer hidden" |
52 | | - @(shouldExpand ? "checked" : string.Empty)> |
| 31 | + <li class="flex flex-wrap pl-4"> |
| 32 | + <label for="@slug" class="peer group flex items-center mr-1"> |
| 33 | + <svg |
| 34 | + xmlns="http://www.w3.org/2000/svg" |
| 35 | + fill="none" |
| 36 | + viewBox="0 0 24 24" |
| 37 | + stroke-width="1.5" |
| 38 | + stroke="currentColor" |
| 39 | + class="w-4 shrink -rotate-90 group-has-checked:rotate-0 cursor-pointer"> |
| 40 | + <path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/> |
| 41 | + </svg> |
| 42 | + <input |
| 43 | + id="@slug" |
| 44 | + type="checkbox" |
| 45 | + class="hidden" |
| 46 | + aria-hidden="true" |
| 47 | + data-should-expand="@shouldExpand.ToLowerString()" |
| 48 | + @(shouldExpand ? "checked" : string.Empty)> |
| 49 | + </label> |
| 50 | + <a |
| 51 | + href="@g.Index?.Url" |
| 52 | + class="block py-1 grow hover:font-bold @(isCurrent ? "font-bold text-blue-elastic" : string.Empty) "> |
| 53 | + @g.Index?.NavigationTitle |
| 54 | + </a> |
53 | 55 | @if (g.NavigationItems.Count > 0) |
54 | 56 | { |
55 | | - <ul class="h-0 peer-checked:h-auto w-full overflow-hidden mt-2" data-has-current="@g.ContainsCurrentPage(Model.CurrentDocument)"> |
| 57 | + <ul class="h-0 grow overflow-hidden peer-has-checked:h-auto w-full overflow-hidden" data-has-current="@g.ContainsCurrentPage(Model.CurrentDocument)"> |
56 | 58 | @await RenderPartialAsync(_TocTreeNav.Create(new NavigationTreeItem |
57 | 59 | { |
58 | 60 | Level = g.Depth, |
|
0 commit comments