diff --git a/src/App.svelte b/src/App.svelte index 1c317d8..1c161ba 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -17,6 +17,10 @@ let showModal = false; let selectedLogo = null; + function setSearchQuery(val) { + searchQuery = val; + } + // Load logos from JSON file with cache busting onMount(async () => { try { @@ -61,6 +65,13 @@ // Open preview if URL contains anchor openLogoByAnchor(window.location.hash); + + // On mount, check for search param in URL and set searchQuery + const params = new URLSearchParams(window.location.search); + const searchParam = params.get("search"); + if (searchParam) { + searchQuery = searchParam; + } }); // Make sure to apply theme whenever it changes @@ -253,6 +264,7 @@ {setGridView} {setListView} bind:searchQuery + setSearchQuery={setSearchQuery} {allTags} {selectedTags} {tagDropdownOpen} diff --git a/src/components/Header.svelte b/src/components/Header.svelte index f7f81be..5640434 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -1,4 +1,6 @@ @@ -104,7 +117,7 @@ aria-label="Search logos" /> {#if searchQuery} -