Include block results when searching for components
This commit is contained in:
parent
081d29e0c4
commit
aa6d483713
|
@ -76,11 +76,9 @@
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split list into either components or blocks initially
|
// Remove blocks if there is no search string
|
||||||
if (section === "components") {
|
if (!search) {
|
||||||
structure = structure.filter(category => category.name !== "Blocks")
|
structure = structure.filter(category => category.name !== "Blocks")
|
||||||
} else {
|
|
||||||
structure = structure.filter(category => category.name === "Blocks")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return only items which match the search string
|
// Return only items which match the search string
|
||||||
|
@ -159,33 +157,31 @@
|
||||||
borderRight
|
borderRight
|
||||||
>
|
>
|
||||||
<Layout paddingX="L" paddingY="XL" gap="S">
|
<Layout paddingX="L" paddingY="XL" gap="S">
|
||||||
<ActionGroup compact justified>
|
<Search
|
||||||
<ActionButton
|
placeholder="Search"
|
||||||
fullWidth
|
value={searchString}
|
||||||
selected={section === "components"}
|
on:change={e => (searchString = e.detail)}
|
||||||
on:click={() => (section = "components")}>Components</ActionButton
|
bind:inputRef={searchRef}
|
||||||
>
|
/>
|
||||||
<ActionButton
|
{#if !searchString}
|
||||||
fullWidth
|
<ActionGroup compact justified>
|
||||||
selected={section === "blocks"}
|
<ActionButton
|
||||||
on:click={() => (section = "blocks")}>Blocks</ActionButton
|
fullWidth
|
||||||
>
|
selected={section === "components"}
|
||||||
</ActionGroup>
|
on:click={() => (section = "components")}>Components</ActionButton
|
||||||
|
>
|
||||||
|
<ActionButton
|
||||||
|
fullWidth
|
||||||
|
selected={section === "blocks"}
|
||||||
|
on:click={() => (section = "blocks")}>Blocks</ActionButton
|
||||||
|
>
|
||||||
|
</ActionGroup>
|
||||||
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
<div>
|
<div>
|
||||||
<Divider noMargin noGrid />
|
<Divider noMargin noGrid />
|
||||||
</div>
|
</div>
|
||||||
{#if section === "components"}
|
{#if searchString || section === "components"}
|
||||||
<Layout paddingX="L" paddingY="XL">
|
|
||||||
<Search
|
|
||||||
placeholder="Search"
|
|
||||||
value={searchString}
|
|
||||||
on:change={e => (searchString = e.detail)}
|
|
||||||
bind:inputRef={searchRef}
|
|
||||||
/>
|
|
||||||
</Layout>
|
|
||||||
{/if}
|
|
||||||
{#if section === "components"}
|
|
||||||
{#each filteredStructure as category}
|
{#each filteredStructure as category}
|
||||||
<DetailSummary name={category.name} collapsible={false}>
|
<DetailSummary name={category.name} collapsible={false}>
|
||||||
<div class="component-grid">
|
<div class="component-grid">
|
||||||
|
|
Loading…
Reference in New Issue