1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00

Update binding panel icons to use new styles

This commit is contained in:
Andrew Kingston 2024-03-13 13:57:24 +00:00
parent 6d53b06762
commit f9156765c0
2 changed files with 63 additions and 26 deletions

View file

@ -3,6 +3,7 @@
import { convertToJS } from "@budibase/string-templates"
import { Input, Layout, Icon, Popover } from "@budibase/bbui"
import { handlebarsCompletions } from "constants/completions"
import { tick } from "svelte"
export let addHelper
export let addBinding
@ -12,6 +13,7 @@
export let context = null
let search = ""
let searching = false
let popover
let popoverAnchor
let hoverTarget
@ -112,6 +114,17 @@
hideTimeout = null
}
}
const startSearching = async () => {
searching = true
search = ""
}
const stopSearching = e => {
e.stopPropagation()
searching = false
search = ""
}
</script>
<Popover
@ -158,25 +171,34 @@
{#if !selectedCategory}
<div class="header">
<span class="search-input">
<Input
placeholder={"Search for bindings"}
autocomplete="off"
bind:value={search}
{#if searching}
<div class="search-input">
<Input
placeholder="Search for bindings"
autocomplete="off"
bind:value={search}
autofocus
/>
</div>
<Icon
size="S"
name="Close"
hoverable
newStyles
on:click={stopSearching}
/>
</span>
<span
class="search-input-icon"
on:click={() => {
search = null
}}
class:searching={search}
>
<Icon size="S" name={search ? "Close" : "Search"} />
</span>
{:else}
<div class="title">Bindings</div>
<Icon
size="S"
name="Search"
hoverable
newStyles
on:click={startSearching}
/>
{/if}
</div>
{/if}
{#if !selectedCategory && !search}
<ul class="category-list">
{#each categoryNames as categoryName}
@ -281,18 +303,15 @@
background: var(--background);
z-index: 1;
}
.header :global(input) {
border: none;
border-radius: 0;
background: none;
padding: 0;
}
.search-input {
flex: 1;
}
.search-input-icon.searching {
cursor: pointer;
.search-input,
.title {
flex: 1 1 auto;
}
ul.category-list {

View file

@ -89,11 +89,29 @@
bind:value={search}
/>
</div>
<Icon size="S" name="Close" hoverable on:click={stopSearching} />
<Icon
size="S"
name="Close"
hoverable
newStyles
on:click={stopSearching}
/>
{:else}
<div class="title">Snippets</div>
<Icon size="S" name="Search" hoverable on:click={startSearching} />
<Icon size="S" name="Add" hoverable on:click={createSnippet} />
<Icon
size="S"
name="Search"
hoverable
newStyles
on:click={startSearching}
/>
<Icon
size="S"
name="Add"
hoverable
newStyles
on:click={createSnippet}
/>
{/if}
</div>
<div class="snippet-list">
@ -108,9 +126,9 @@
<Icon
name="Edit"
hoverable
newStyles
size="S"
on:click={e => editSnippet(e, snippet)}
color="var(--spectrum-global-color-gray-700)"
/>
</div>
{/each}