Switch bindingPanel to use new Drawer content component

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-28 10:10:48 +02:00
parent da993b47f1
commit 4c776f68f2
2 changed files with 41 additions and 33 deletions

View File

@ -21,7 +21,6 @@
} }
.sidebar { .sidebar {
border-right: var(--border-light); border-right: var(--border-light);
padding: var(--spacing-l);
overflow: auto; overflow: auto;
} }
@ -30,7 +29,6 @@
} }
.main { .main {
padding: var(--spacing-l);
font-family: var(--font-sans); font-family: var(--font-sans);
} }
.main :global(textarea) { .main :global(textarea) {

View File

@ -1,6 +1,6 @@
<script> <script>
import groupBy from "lodash/fp/groupBy" import groupBy from "lodash/fp/groupBy"
import { Search, TextArea, Heading, Spacer, Label, Layout, DrawerContentWithSidebar } from "@budibase/bbui" import { Search, TextArea, Heading, Label, DrawerContentWithSidebar, Layout } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isValid } from "@budibase/string-templates" import { isValid } from "@budibase/string-templates"
import { import {
@ -58,12 +58,12 @@
</script> </script>
<DrawerContentWithSidebar> <DrawerContentWithSidebar>
<Search placeholder="Search" bind:value={search} />
<svelte:fragment slot="sidebar"> <svelte:fragment slot="sidebar">
<Spacer medium /> <Layout>
<Search placeholder="Search" bind:value={search} />
{#if context} {#if context}
<section>
<Heading xs h3>Columns</Heading> <Heading xs h3>Columns</Heading>
<Spacer small />
<ul> <ul>
{#each context.filter((context) => {#each context.filter((context) =>
context.readableBinding.match(searchRgx) context.readableBinding.match(searchRgx)
@ -73,11 +73,11 @@
</li> </li>
{/each} {/each}
</ul> </ul>
</section>
{/if} {/if}
<Spacer small />
{#if instance} {#if instance}
<section>
<Heading xs h3>Components</Heading> <Heading xs h3>Components</Heading>
<Spacer small />
<ul> <ul>
{#each instance.filter((instance) => {#each instance.filter((instance) =>
instance.readableBinding.match(searchRgx) instance.readableBinding.match(searchRgx)
@ -87,10 +87,10 @@
</li> </li>
{/each} {/each}
</ul> </ul>
</section>
{/if} {/if}
<Spacer small /> <section>
<Heading xs h3>Helpers</Heading> <Heading xs h3>Helpers</Heading>
<Spacer small />
<ul> <ul>
{#each helpers.filter((helper) => helper.label.match(searchRgx) || helper.description.match(searchRgx)) as helper} {#each helpers.filter((helper) => helper.label.match(searchRgx) || helper.description.match(searchRgx)) as helper}
<li on:click={() => addToText(helper.text)}> <li on:click={() => addToText(helper.text)}>
@ -104,8 +104,10 @@
</li> </li>
{/each} {/each}
</ul> </ul>
</section>
</Layout>
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="main"> <div class="main" slot="main">
<TextArea <TextArea
bind:getCaretPosition bind:getCaretPosition
bind:value bind:value
@ -118,10 +120,17 @@
for more details. for more details.
</p> </p>
{/if} {/if}
</svelte:fragment> </div>
</DrawerContentWithSidebar> </DrawerContentWithSidebar>
<style> <style>
.main {
padding: var(--spacing-m)
}
section {
display: grid;
grid-gap: var(--spacing-s);
}
ul { ul {
list-style: none; list-style: none;
padding-left: 0; padding-left: 0;
@ -134,10 +143,11 @@
font-family: var(--font-sans); font-family: var(--font-sans);
font-size: var(--font-size-xs); font-size: var(--font-size-xs);
color: var(--grey-7); color: var(--grey-7);
padding: var(--spacing-m) 0; padding: var(--spacing-m);
margin: auto 0px; margin: auto 0px;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
border-radius: var(--spacing-s);
border: var(--border-light); border: var(--border-light);
border-width: 1px 0 1px 0; border-width: 1px 0 1px 0;
} }
@ -148,8 +158,8 @@
} }
li:hover { li:hover {
color: var(--ink); background-color: var(--grey-2);
font-weight: 500; cursor: pointer;
} }
li:active { li:active {