@@ -32,22 +32,20 @@ const sidebar: Record<string, Link[]> = {
3232 <ul class =" nav-groups" >
3333 {
3434 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 >
5149 </li >
5250 ))
5351 }
@@ -68,30 +66,63 @@ const sidebar: Record<string, Link[]> = {
6866 width: 100%;
6967 }
7068
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+
7194 .nav-groups {
7295 height: 100%;
73- padding: 2rem 0;
96+ margin: 0;
97+ padding: 0;
7498 overflow-y: auto;
7599 max-height: 100vh;
76100
77- > li + li {
78- margin-top: 1rem;
79- }
80-
81101 > :first-child {
82102 padding-top: var(--doc-padding);
83103 }
84104
85105 > :last-child {
86106 padding-bottom: 2rem;
87- margin-bottom: var(--theme-navbar-height);
88107 }
89108
90109 @media (min-width: 50em) {
91110 padding: 0;
92111 }
93112 }
94113
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+
95126 .nav-group-title {
96127 font-size: 0.76rem;
97128 font-weight: 400;
@@ -102,29 +133,6 @@ const sidebar: Record<string, Link[]> = {
102133 padding: 0 0.5rem;
103134 text-transform: uppercase;
104135 }
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- }
128136</style >
129137
130138<style is:global >
0 commit comments