Skip to content

Commit 38aa4af

Browse files
committed
Improve menu style
1 parent 8f60474 commit 38aa4af

File tree

2 files changed

+57
-33
lines changed

2 files changed

+57
-33
lines changed

themes/opentermsarchive/assets/css/components/aside.css

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,39 @@
1212
}
1313

1414
.aside_nav {
15+
16+
& a{
17+
color: var(--colorBlack800);
18+
z-index:1;
19+
position:relative;
20+
display:block;
21+
22+
&:hover{
23+
&:before{
24+
content:"";
25+
position:absolute;
26+
left:calc(var(--xs) * -1);
27+
right:0;
28+
top:calc(var(--3xs) * -1);
29+
bottom:calc(var(--3xs) * -1);
30+
width:calc(100% + var(--xs));
31+
height:calc(100% + var(--2xs));
32+
z-index:-1;
33+
background-color: var(--colorBlack200);
34+
}
35+
}
36+
}
37+
38+
& .aside_item-current{
39+
font-weight: bold;
40+
41+
& a{
42+
color: var(--colorPrimary);
43+
}
44+
}
45+
1546
ul {
16-
color: var(--colorBlack600);
47+
color: var(--colorBlack800);
1748
display: flex;
1849
gap:var(--m3XS);
1950
flex-direction: column;
@@ -22,46 +53,38 @@
2253
& ul {
2354
& li {
2455
& ul {
56+
margin-top:var(--2xs);
2557
border-left:1px solid var(--colorBlack300);
2658
padding-left:var(--pXS);
59+
/* margin-left:var(--mXS); */
2760
}
2861
}
2962
}
3063
}
3164
}
32-
}
3365

34-
.aside_item-current {
35-
font-weight: bold;
36-
z-index:1;
37-
position:relative;
38-
39-
& a{
66+
summary{
67+
display:flex;
68+
align-items:center;
69+
gap:var(--2xs);
70+
cursor:pointer;
4071
color: var(--colorBlack800);
41-
}
42-
43-
&:before{
44-
content:"";
45-
position:absolute;
46-
left:calc(var(--xs) * -1);
47-
right:0;
48-
top:calc(var(--3xs) * -1);
49-
bottom:calc(var(--3xs) * -1);
50-
width:calc(100% + var(--xs));
51-
height:calc(100% + var(--2xs));
52-
z-index:-1;
53-
background-color: var(--colorBlack200);
72+
73+
& .icon{
74+
margin-top:var(--3xs);
75+
}
5476
}
5577
}
5678

5779
.aside_item-section{
5880
display:inline-block;
59-
margin-top:var(--mXS);
60-
color: var(--colorBlack600);
81+
margin-top:var(--m);
82+
color: var(--colorBlack800);
83+
font-weight: bold;
6184
}
6285

6386
.aside_item-subsection{
6487
display:inline-block;
6588
margin-top:var(--m2XS);
66-
color: var(--colorBlack600);
89+
color: var(--colorBlack800);
6790
}

themes/opentermsarchive/layouts/partials/aside.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@
1313
<li {{ if eq $currentPageSection .Section }}class="aside_item-current-section"{{ end }}>
1414
{{ $allPages := .RegularPages.ByWeight | append .Sections.ByWeight }}
1515
{{ $allPages := sort $allPages "Weight" }}
16-
<span class="aside_item-section"><b>{{ .LinkTitle | markdownify }}</b></span>
16+
<span class="aside_item-section">{{ .LinkTitle | markdownify }}</span>
1717
<ul>
1818
{{ range $allPages }}
1919
{{ if .Content }}
2020
<li {{ if eq $currentPageRelPermalink .RelPermalink }}class="aside_item-current"{{ end }}><a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a></li>
21-
{{ else }}
22-
<li><span class="aside_item-subsection">{{ .LinkTitle | markdownify }}</span></li>
2321
{{ end }}
2422
{{ if .IsSection }}
2523
<li>
26-
<ul>
27-
{{ range .RegularPages.ByWeight }}
28-
<li {{ if eq $currentPageRelPermalink .RelPermalink }}class="aside_item-current"{{ end }}><a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a></li>
29-
{{ end }}
30-
</ul>
24+
<details {{ if eq $currentPageRelPermalink .RelPermalink }}open{{ end }}>
25+
<summary class="aside_item-subsection">{{ .LinkTitle | markdownify }}<i class="icon" data-lucide="chevron-down"></i></summary>
26+
<ul>
27+
{{ range .RegularPages.ByWeight }}
28+
<li {{ if eq $currentPageRelPermalink .RelPermalink }}class="aside_item-current"{{ end }}><a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a></li>
29+
{{ end }}
30+
</ul>
31+
</details>
3132
</li>
3233
{{ end }}
3334
{{ end }}
34-
</ul>
35+
</ul>
3536
</li>
3637
{{ end }}
3738
</ul>

0 commit comments

Comments
 (0)