From aa6d483713c9a3a0a4db5c269fb85387e295ee7f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 7 Jun 2022 15:08:46 +0100 Subject: [PATCH] Include block results when searching for components --- .../new/_components/NewComponentPanel.svelte | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/new/_components/NewComponentPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/new/_components/NewComponentPanel.svelte index 39ee1cb44a..c540af5d4f 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/new/_components/NewComponentPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/new/_components/NewComponentPanel.svelte @@ -76,11 +76,9 @@ return [] } - // Split list into either components or blocks initially - if (section === "components") { + // Remove blocks if there is no search string + if (!search) { structure = structure.filter(category => category.name !== "Blocks") - } else { - structure = structure.filter(category => category.name === "Blocks") } // Return only items which match the search string @@ -159,33 +157,31 @@ borderRight > - - (section = "components")}>Components - (section = "blocks")}>Blocks - + (searchString = e.detail)} + bind:inputRef={searchRef} + /> + {#if !searchString} + + (section = "components")}>Components + (section = "blocks")}>Blocks + + {/if}
- {#if section === "components"} - - (searchString = e.detail)} - bind:inputRef={searchRef} - /> - - {/if} - {#if section === "components"} + {#if searchString || section === "components"} {#each filteredStructure as category}