Remove useless concept of headless drawer and fix issue with drawer observer

This commit is contained in:
Andrew Kingston 2024-02-27 13:28:13 +00:00
parent e10dd49540
commit c12d3cffc3
2 changed files with 8 additions and 16 deletions

View File

@ -44,7 +44,7 @@
if (get(openDrawers).length) {
return
}
observer.disconnect()
observer?.disconnect()
observer = null
}
</script>
@ -57,7 +57,6 @@
import { fade } from "svelte/transition"
export let title
export let headless = false
const dispatch = createEventDispatcher()
const spacing = 11
@ -156,21 +155,18 @@
{/if}
<div
class="drawer"
class:headless
class:stacked={depth > 0}
class:modal={$modal}
transition:slide|local
{style}
>
{#if !headless}
<header>
<div class="text">{title}</div>
<div class="buttons">
<Button secondary quiet on:click={hide}>Cancel</Button>
<slot name="buttons" />
</div>
</header>
{/if}
<header>
<div class="text">{title}</div>
<div class="buttons">
<Button secondary quiet on:click={hide}>Cancel</Button>
<slot name="buttons" />
</div>
</header>
<slot name="body" />
{#if !$modal && depth > 0}
<div class="overlay" transition:fade|local={{ duration: 260 }} />

View File

@ -175,11 +175,7 @@
bind:this={bindingDrawer}
{title}
left={drawerLeft}
headless
>
<svelte:fragment slot="description">
Add the objects on the left to enrich your text.
</svelte:fragment>
<Button cta slot="buttons" disabled={!valid} on:click={saveBinding}>
Save
</Button>