diff --git a/src/lib/components/Layout/Header.svelte b/src/lib/components/Layout/Header.svelte index 15aac27..a66202e 100644 --- a/src/lib/components/Layout/Header.svelte +++ b/src/lib/components/Layout/Header.svelte @@ -2,32 +2,51 @@ import SearchBar from '../SearchBar.svelte'; import SyncIndicator from '../SyncIndicator.svelte'; import Menu from 'lucide-svelte/icons/menu'; + import Search from 'lucide-svelte/icons/search'; interface Props { onMenuToggle: () => void; } let { onMenuToggle }: Props = $props(); + let mobileSearchOpen = $state(false);
- + {#if mobileSearchOpen} + +
+ (mobileSearchOpen = false)} /> +
+ {:else} + -
-

Crumbs

-
+
+

Crumbs

+
-
- -
+ + -
- -
+ + + +
+ +
+ {/if}
diff --git a/src/lib/components/SearchBar.svelte b/src/lib/components/SearchBar.svelte index 02c8549..32c517a 100644 --- a/src/lib/components/SearchBar.svelte +++ b/src/lib/components/SearchBar.svelte @@ -3,10 +3,22 @@ import type { Note } from '$lib/types/index.js'; import Search from 'lucide-svelte/icons/search'; import X from 'lucide-svelte/icons/x'; + import ArrowLeft from 'lucide-svelte/icons/arrow-left'; + + interface Props { + onClose?: () => void; + } + + let { onClose }: Props = $props(); let query = $state(''); let originalNotes: Note[] = []; let isSearching = $state(false); + let inputEl: HTMLInputElement | undefined = $state(); + + $effect(() => { + if (onClose) inputEl?.focus(); + }); async function handleSearch() { if (!query.trim()) { @@ -36,12 +48,24 @@ isSearching = false; } } + + function close() { + clearSearch(); + onClose?.(); + } -
+
- + {#if onClose} + + {:else} + + {/if}