@@ -32,22 +32,20 @@ const sidebar: Record<string, Link[]> = {
32
32
<ul class =" nav-groups" >
33
33
{
34
34
Object .entries (sidebar ).map (([header , children ]) => (
35
- <li >
36
- <div class = " nav-group" >
37
- <h2 class = " nav-group-title" >{ header } </h2 >
38
- <ul >
39
- { children .map ((child ) => {
40
- const url = Astro .site ?.pathname + child .url ;
41
- return (
42
- <li class = " nav-link" >
43
- <a href = { url } aria-current = { currentPageMatch === child .url ? " page" : false } >
44
- { child .text }
45
- </a >
46
- </li >
47
- );
48
- })}
49
- </ul >
50
- </div >
35
+ <li class = " nav-group" >
36
+ <h2 class = " nav-group-title" >{ header } </h2 >
37
+ <ul class = " nav-group-subnav" >
38
+ { children .map ((child ) => {
39
+ const url = Astro .site ?.pathname + child .url ;
40
+ return (
41
+ <li class = " nav-link" >
42
+ <a class = " link" href = { url } aria-current = { currentPageMatch === child .url ? " page" : false } >
43
+ { child .text }
44
+ </a >
45
+ </li >
46
+ );
47
+ })}
48
+ </ul >
51
49
</li >
52
50
))
53
51
}
@@ -68,30 +66,63 @@ const sidebar: Record<string, Link[]> = {
68
66
width: 100%;
69
67
}
70
68
69
+ .link {
70
+ color: inherit;
71
+ display: block;
72
+ font-size: 0.875rem;
73
+ line-height: 1;
74
+ margin: 1px;
75
+ padding: 0.25rem 0.5rem;
76
+ text-decoration: none;
77
+
78
+ @media (min-width: 600px) {
79
+ padding: 0.375rem;
80
+ }
81
+
82
+ &:hover,
83
+ &:focus {
84
+ background-color: var(--theme-bg-hover);
85
+ }
86
+
87
+ &[aria-current="page"] {
88
+ color: var(--theme-text-accent);
89
+ background-color: var(--theme-bg-accent);
90
+ font-weight: 500;
91
+ }
92
+ }
93
+
71
94
.nav-groups {
72
95
height: 100%;
73
- padding: 2rem 0;
96
+ margin: 0;
97
+ padding: 0;
74
98
overflow-y: auto;
75
99
max-height: 100vh;
76
100
77
- > li + li {
78
- margin-top: 1rem;
79
- }
80
-
81
101
> :first-child {
82
102
padding-top: var(--doc-padding);
83
103
}
84
104
85
105
> :last-child {
86
106
padding-bottom: 2rem;
87
- margin-bottom: var(--theme-navbar-height);
88
107
}
89
108
90
109
@media (min-width: 50em) {
91
110
padding: 0;
92
111
}
93
112
}
94
113
114
+ .nav-group {
115
+ margin-top: 1rem;
116
+
117
+ &:first-of-type {
118
+ margin-top: 0;
119
+ }
120
+ }
121
+
122
+ .nav-group-subnav {
123
+ margin-top: 0.6;
124
+ }
125
+
95
126
.nav-group-title {
96
127
font-size: 0.76rem;
97
128
font-weight: 400;
@@ -102,29 +133,6 @@ const sidebar: Record<string, Link[]> = {
102
133
padding: 0 0.5rem;
103
134
text-transform: uppercase;
104
135
}
105
-
106
- .nav-link {
107
- a {
108
- color: inherit;
109
- display: block;
110
- font-size: 0.875rem;
111
- line-height: 1;
112
- margin: 1px;
113
- padding: 0.375rem;
114
- text-decoration: none;
115
-
116
- &:hover,
117
- &:focus {
118
- background-color: var(--theme-bg-hover);
119
- }
120
-
121
- &[aria-current="page"] {
122
- color: var(--theme-text-accent);
123
- background-color: var(--theme-bg-accent);
124
- font-weight: 500;
125
- }
126
- }
127
- }
128
136
</style >
129
137
130
138
<style is:global >
0 commit comments