|
49 | 49 | }
|
50 | 50 | </script>
|
51 | 51 |
|
52 |
| -<button class="menu-toggle" on:click={() => (is_open = !is_open)} aria-label="Toggle menu" aria-expanded={is_open}> |
53 |
| - <Icon name={is_open ? 'close' : 'menu'} /> |
54 |
| -</button> |
| 52 | +<div class="menu-toggle-container"> |
| 53 | + <button |
| 54 | + class="menu-toggle" |
| 55 | + on:click={() => (is_open = !is_open)} |
| 56 | + aria-label="Toggle menu" |
| 57 | + aria-expanded={is_open} |
| 58 | + > |
| 59 | + <Icon name={is_open ? 'close' : 'menu'} /> |
| 60 | + </button> |
| 61 | +</div> |
55 | 62 |
|
56 | 63 | <nav class:open={is_open} aria-label="tutorial sections">
|
57 | 64 | <div class="controls">
|
58 |
| - <input type="search" placeholder="Search" bind:value={search} aria-hidden={!is_open ? "true" : null} tabindex={!is_open ? -1 : null} /> |
| 65 | + <input |
| 66 | + type="search" |
| 67 | + placeholder="Search" |
| 68 | + bind:value={search} |
| 69 | + aria-hidden={!is_open ? 'true' : null} |
| 70 | + tabindex={!is_open ? -1 : null} |
| 71 | + /> |
59 | 72 | </div>
|
60 | 73 |
|
61 | 74 | <div class="sections">
|
62 | 75 | <ul>
|
63 | 76 | {#each filtered as part (part.slug)}
|
64 |
| - <li class="part" transition:slide|local={{ duration }}> |
| 77 | + <li |
| 78 | + class="part" |
| 79 | + transition:slide|local={{ duration }} |
| 80 | + class:expanded={part.slug === current.part.slug} |
| 81 | + > |
65 | 82 | <a sveltekit:prefetch href="/tutorial/{part.first}" data-label={part.label}>
|
66 | 83 | Part {part.label}: {part.title}
|
67 | 84 | </a>
|
|
114 | 131 | height: 100%;
|
115 | 132 | transition: transform 0.2s;
|
116 | 133 | transform: translate(calc(var(--menu-width) - 100%), 0);
|
117 |
| - background: var(--second); |
| 134 | + background: var(--back-api); |
118 | 135 | z-index: 2;
|
119 | 136 | /* filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1)); */
|
120 |
| - border-right: 1px solid rgba(255, 255, 255, 0.1); |
| 137 | + border-right: 1px solid var(--border-color); |
121 | 138 | display: flex;
|
122 | 139 | flex-direction: column;
|
123 | 140 | }
|
|
129 | 146 | .controls {
|
130 | 147 | height: var(--menu-width);
|
131 | 148 | display: flex;
|
132 |
| - border-bottom: 1px solid rgba(255, 255, 255, 0.1); |
133 |
| - padding: 1rem 1rem 1rem calc(var(--menu-width) + 1rem); |
| 149 | + border-bottom: 1px solid var(--border-color); |
| 150 | + padding: 0 0 0 var(--menu-width); |
134 | 151 | }
|
135 | 152 |
|
136 | 153 | .controls input {
|
137 | 154 | flex: 1;
|
138 |
| - border-radius: 0.5rem; |
139 | 155 | border: none;
|
140 | 156 | padding: 0.6rem 1rem 0.5rem 1rem;
|
141 | 157 | font-family: inherit;
|
142 | 158 | font-size: inherit;
|
143 |
| - background: hsl(240, 8%, 54%); |
144 |
| - color: white; |
145 |
| - } |
146 |
| -
|
147 |
| - .controls input::placeholder { |
148 |
| - color: rgba(255, 255, 255, 0.5); |
| 159 | + background: rgba(255, 255, 255, 0.5); |
| 160 | + border: 2px solid transparent; |
| 161 | + color: var(--text); |
149 | 162 | }
|
150 | 163 |
|
151 | 164 | .controls input:focus {
|
152 |
| - background: white; |
153 |
| - color: var(--text); |
154 | 165 | outline: none;
|
| 166 | + border: 2px solid var(--flash); |
155 | 167 | }
|
156 | 168 |
|
157 |
| - .controls input:focus::placeholder { |
158 |
| - color: #333; |
159 |
| - } |
160 |
| -
|
161 |
| - .menu-toggle { |
| 169 | + .menu-toggle-container { |
162 | 170 | position: absolute;
|
163 | 171 | left: 0;
|
164 | 172 | top: 0;
|
165 | 173 | width: var(--menu-width);
|
166 | 174 | height: var(--menu-width);
|
167 | 175 | z-index: 3;
|
168 |
| - /* background: linear-gradient( |
169 |
| - to right, |
170 |
| - var(--second), |
171 |
| - var(--second) calc(100% - 1rem), |
172 |
| - transparent |
173 |
| - ); */ |
174 |
| - background: var(--second); |
175 |
| - border-bottom: 1px solid rgba(255, 255, 255, 0.1); |
176 |
| - border-right: 1px solid rgba(255, 255, 255, 0.1); |
| 176 | + border-right: 1px solid var(--border-color); |
| 177 | + border-bottom: 1px solid var(--border-color); |
| 178 | + } |
| 179 | +
|
| 180 | + .menu-toggle { |
| 181 | + width: 100%; |
| 182 | + height: 100%; |
| 183 | + background: var(--back-api); |
| 184 | + border: 2px solid transparent; |
| 185 | + box-sizing: border-box; |
| 186 | + } |
| 187 | +
|
| 188 | + .menu-toggle:focus-visible { |
| 189 | + outline: none; |
| 190 | + border: 2px solid var(--flash); |
177 | 191 | }
|
178 | 192 |
|
179 | 193 | .sections {
|
|
185 | 199 | ul {
|
186 | 200 | position: relative;
|
187 | 201 | list-style: none;
|
188 |
| - padding: 0 0 0 2rem; |
| 202 | + padding: 0 0 0 1.5rem; |
189 | 203 | margin: 0;
|
190 | 204 | }
|
191 | 205 |
|
|
197 | 211 | position: relative;
|
198 | 212 | }
|
199 | 213 |
|
200 |
| - li[aria-current='page'] { |
201 |
| - font-weight: bold; |
| 214 | + li[aria-current='page'] a { |
| 215 | + color: var(--prime); |
202 | 216 | }
|
203 | 217 |
|
204 | 218 | li img {
|
205 | 219 | position: absolute;
|
206 |
| - left: -2.5rem; |
| 220 | + left: -2rem; |
207 | 221 | top: 0.3rem;
|
208 | 222 | width: 2rem;
|
209 | 223 | height: 2rem;
|
210 | 224 | transition: transform 0.2s;
|
211 | 225 | }
|
212 | 226 |
|
| 227 | + li.expanded > a { |
| 228 | + font-weight: bold; |
| 229 | + } |
| 230 | +
|
213 | 231 | li.expanded img {
|
214 | 232 | transform: rotate(90deg);
|
215 | 233 | }
|
|
221 | 239 |
|
222 | 240 | .section {
|
223 | 241 | --dot-size: 1.2rem;
|
224 |
| - --color: hsl(240, 8%, 95%); |
| 242 | + --color: var(--second); |
225 | 243 | }
|
226 | 244 |
|
227 | 245 | .section > a::before,
|
228 | 246 | .section > a::after {
|
229 | 247 | content: '';
|
230 | 248 | top: calc(1.3rem - 0.5 * var(--dot-size));
|
231 |
| - right: calc(0.5 * (var(--menu-width) - var(--dot-size))); |
| 249 | + right: calc(0.5 * (var(--menu-width) - var(--dot-size)) - 0.7rem); |
232 | 250 | width: var(--dot-size);
|
233 | 251 | height: var(--dot-size);
|
234 | 252 | border-radius: 50%;
|
|
248 | 266 | width: var(--menu-width);
|
249 | 267 | text-align: center;
|
250 | 268 | top: 0.2rem;
|
251 |
| - right: 0; |
| 269 | + right: -0.7rem; |
252 | 270 | color: hsl(240, 8%, 64%);
|
253 | 271 | }
|
254 | 272 |
|
|
257 | 275 | }
|
258 | 276 |
|
259 | 277 | a {
|
260 |
| - color: white; |
261 |
| - padding: 0.2rem 0; |
| 278 | + color: var(--second); |
| 279 | + padding: 0 0 0 0.5rem; |
| 280 | + margin: 0 0.5rem 0 0; |
262 | 281 | display: block;
|
263 | 282 | font-variant-numeric: tabular-nums;
|
| 283 | + border: 2px solid transparent; |
| 284 | + box-sizing: border-box; |
| 285 | + } |
| 286 | +
|
| 287 | + a:focus-visible { |
| 288 | + /* outline-color: var(--flash); */ |
| 289 | + outline: none; |
| 290 | + border: 2px solid var(--flash); |
264 | 291 | }
|
265 | 292 | </style>
|
0 commit comments