From 83542af81d7138782c364f2f223ba2d15146afd7 Mon Sep 17 00:00:00 2001 From: AlexBocken Date: Tue, 11 Jul 2023 19:07:26 +0200 Subject: [PATCH] correctly show matching recipes --- src/lib/components/Search.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte index fbe0626..1a27085 100644 --- a/src/lib/components/Search.svelte +++ b/src/lib/components/Search.svelte @@ -19,7 +19,7 @@ onMount(() => { const searchString = `${recipe.textContent} ${recipe.dataset.tags}`.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, ""); const isMatch = searchTerms.every(term => searchString.includes(term)); - recipe.style.display = (isMatch ? 'block' : 'none'); + recipe.style.display = (isMatch ? 'flex' : 'none'); recipe.classList.toggle("matched-recipe", hasFilter && isMatch); }) } @@ -31,7 +31,7 @@ onMount(() => { clearSearch.addEventListener("click", () => { search.value = ""; recipes.forEach(recipe => { - recipe.style.display = 'block'; + recipe.style.display = 'flex'; recipe.classList.remove("matched-recipe"); }) }) @@ -105,7 +105,7 @@ scale: 0.8 0.8; }