|
17 | 17 |
|
18 | 18 | .navigator { |
19 | 19 | flex-direction: column; |
20 | | - position: relative; |
| 20 | + position: fixed; |
| 21 | + top: 0; |
| 22 | + left: 0; |
| 23 | + bottom: 0; |
21 | 24 | height: 100dvh; |
22 | 25 | overflow-x: hidden; |
23 | 26 | overflow-y: scroll; |
24 | 27 | background: var(--neutral-base-normal); |
25 | 28 | border-right: 1px solid var(--neutral-border-soft); |
26 | 29 | font-size: var(--font-size-3); |
| 30 | + z-index: 999; |
27 | 31 |
|
28 | 32 | @media screen and (min-width: 768px) { |
29 | | - min-width: 20rem; |
30 | | - width: 20rem; |
| 33 | + min-width: var(--size-navigator); |
| 34 | + width: var(--size-navigator); |
31 | 35 | } |
32 | 36 | } |
33 | 37 |
|
|
46 | 50 | border-bottom: 1px solid var(--neutral-border-soft); |
47 | 51 | font-size: var(--font-size-3); |
48 | 52 |
|
49 | | - min-height: var(--space-chrome); |
50 | | - height: var(--space-chrome); |
| 53 | + min-height: var(--size-chrome); |
| 54 | + height: var(--size-chrome); |
51 | 55 | padding-left: var(--space); |
52 | 56 | padding-right: var(--space); |
53 | 57 |
|
|
273 | 277 | background: var(--neutral-base-normal); |
274 | 278 | display: flex; |
275 | 279 | align-items: center; |
276 | | - gap: var(--space-half); |
| 280 | + gap: var(--space); |
277 | 281 | padding-left: var(--space-half); |
278 | 282 |
|
279 | | - min-height: var(--space-chrome); |
280 | | - height: var(--space-chrome); |
| 283 | + min-height: var(--size-chrome); |
| 284 | + height: var(--size-chrome); |
281 | 285 | padding-left: var(--space); |
282 | 286 | padding-right: var(--space); |
283 | 287 |
|
284 | 288 | svg { |
| 289 | + margin-left: var(--space-half); |
285 | 290 | pointer-events: none; |
286 | 291 | fill: var(--neutral-text-soft); |
287 | 292 | } |
|
365 | 370 | }); |
366 | 371 | }); |
367 | 372 |
|
| 373 | + // Restore details state from localStorage |
| 374 | + function getDetailsKey(details) { |
| 375 | + const link = details.querySelector('summary a'); |
| 376 | + return link ? link.getAttribute('href') : null; |
| 377 | + } |
| 378 | +
|
| 379 | + function saveDetailsState() { |
| 380 | + const state = {}; |
| 381 | + document.querySelectorAll('.directory details').forEach(details => { |
| 382 | + const key = getDetailsKey(details); |
| 383 | + if (key) { |
| 384 | + state[key] = details.open; |
| 385 | + } |
| 386 | + }); |
| 387 | + localStorage.setItem('detailsState', JSON.stringify(state)); |
| 388 | + } |
| 389 | +
|
| 390 | + function restoreDetailsState() { |
| 391 | + const savedState = localStorage.getItem('detailsState'); |
| 392 | + if (!savedState) return; |
| 393 | +
|
| 394 | + try { |
| 395 | + const state = JSON.parse(savedState); |
| 396 | + document.querySelectorAll('.directory details').forEach(details => { |
| 397 | + const key = getDetailsKey(details); |
| 398 | + if (key && state.hasOwnProperty(key)) { |
| 399 | + details.open = state[key]; |
| 400 | + } |
| 401 | + }); |
| 402 | + } catch (e) { |
| 403 | + console.error('Failed to restore details state:', e); |
| 404 | + } |
| 405 | + } |
| 406 | +
|
| 407 | + // Restore state on page load |
| 408 | + restoreDetailsState(); |
| 409 | +
|
| 410 | + // Save state whenever a details element is toggled |
| 411 | + document.querySelectorAll('.directory details').forEach(details => { |
| 412 | + details.addEventListener('toggle', saveDetailsState); |
| 413 | + }); |
| 414 | +
|
368 | 415 | // Toggle details |
369 | 416 | const toggleButton = document.querySelector('.toggle-details'); |
370 | 417 | if (toggleButton) { |
|
375 | 422 | allDetails.forEach(details => { |
376 | 423 | details.open = !anyOpen; |
377 | 424 | }); |
| 425 | +
|
| 426 | + // Save the new state after toggling all |
| 427 | + saveDetailsState(); |
378 | 428 | }); |
379 | 429 | } |
380 | 430 |
|
|
554 | 604 |
|
555 | 605 | if (query === '') { |
556 | 606 | // Reset: show all items and restore original details state |
| 607 | + directory.classList.remove('searching', 'no-results'); |
557 | 608 | directory.querySelectorAll('a, details, li').forEach(el => { |
558 | 609 | el.style.display = ''; |
559 | 610 | }); |
560 | 611 | return; |
561 | 612 | } |
562 | 613 |
|
| 614 | + // Add searching class |
| 615 | + directory.classList.add('searching'); |
| 616 | +
|
563 | 617 | // Open all details when searching |
564 | 618 | directory.querySelectorAll('details').forEach(details => { |
565 | 619 | details.open = true; |
|
594 | 648 | } |
595 | 649 | }); |
596 | 650 |
|
597 | | - // Show "nah mate, nothin here" if no results |
| 651 | + // Add/remove no-results class and show message |
598 | 652 | if (!hasResults) { |
| 653 | + directory.classList.add('no-results'); |
599 | 654 | noResultsMessage = document.createElement('div'); |
600 | 655 | noResultsMessage.textContent = 'nah mate, nothin here'; |
601 | 656 | noResultsMessage.style.padding = '1rem'; |
602 | 657 | directory.appendChild(noResultsMessage); |
| 658 | + } else { |
| 659 | + directory.classList.remove('no-results'); |
603 | 660 | } |
604 | 661 | }); |
605 | 662 | } |
|
690 | 747 | <li class="list-item"> |
691 | 748 | <a href="{{ post.url }}" class="{{ page.url | isActive(post.url) }}"> |
692 | 749 | <iconcontainer> |
693 | | - <svg class="icon" height="18" width="18"><use href="#envelope-simple"></use></svg> |
| 750 | + <svg class="icon" height="18" width="18"><use href="#note"></use></svg> |
694 | 751 | <h3>{{ post.data.title }}</h3> |
695 | 752 | </iconcontainer> |
696 | 753 | </a> |
|
0 commit comments