diff --git a/packages/bbui/src/Drawer/Drawer.svelte b/packages/bbui/src/Drawer/Drawer.svelte index fd3cf5bed8..d05f59bc41 100644 --- a/packages/bbui/src/Drawer/Drawer.svelte +++ b/packages/bbui/src/Drawer/Drawer.svelte @@ -74,17 +74,15 @@ --spacing: ${spacing}px; ` // Most modal styles are handled by class names - if (modal) { + if (modal || left == null || width == null) { return style } - // Normal drawers need a few additional styles - left = left ? `${left + width / 2}px` : "20vw" - width = width ? `${width - 2 * spacing}px` : "60vw" + // Drawers observing another dom node need custom position styles return ` ${style} - left: ${left}; - width: ${width}; + left: ${left + spacing}px; + width: ${width - 2 * spacing}px; ` } @@ -130,7 +128,7 @@ const f = easeInOutQuad(t) const yOffset = (1 - f) * 200 return ` - transform: translateX(-50%) translateY(calc(${yOffset}px + 50% - 1200px * (1 - var(--scale-factor)))); + transform: translateY(calc(${yOffset}px - 800px * (1 - var(--scale-factor)))); opacity:${f}; ` }, @@ -159,6 +157,7 @@
0} class:modal={$modal} transition:slide|local {style} @@ -183,8 +182,10 @@