1
0
Fork 0
mirror of synced 2024-09-08 13:41:09 +12:00

Fix side panel messing up builder preview scrolling and properly show/hide side panel when inside builder

This commit is contained in:
Andrew Kingston 2022-11-22 16:00:17 +00:00
parent c868cda7dd
commit be3a004310
2 changed files with 22 additions and 3 deletions

View file

@ -251,6 +251,7 @@
id="side-panel-container"
class:open={$sidePanelStore.open}
use:clickOutside={sidePanelStore.actions.close}
class:builder={$builderStore.inBuilder}
>
<div class="side-panel-header">
<Icon
@ -361,10 +362,19 @@
margin-right: -400px;
height: 100%;
}
#side-panel-container.builder {
margin-right: 0;
opacity: 0;
pointer-events: none;
}
#side-panel-container.open {
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.1);
margin-right: 0;
}
#side-panel-container.builder.open {
opacity: 1;
pointer-events: all;
}
.side-panel-header {
display: flex;
flex-direction: row;

View file

@ -4,9 +4,18 @@
const component = getContext("component")
const { styleable, sidePanelStore, builderStore } = getContext("sdk")
$: appOpen = $sidePanelStore.contentId === $component.id
$: builderOpen = $component.inSelectedPath
$: open = $builderStore.inBuilder ? builderOpen : appOpen
$: open = $sidePanelStore.contentId === $component.id
// Automatically show and hide the side panel when inside the builder
$: {
if ($builderStore.inBuilder) {
if ($component.inSelectedPath && !open) {
sidePanelStore.actions.open($component.id)
} else if (!$component.inSelectedPath && open) {
sidePanelStore.actions.close()
}
}
}
const showInSidePanel = (el, visible) => {
const target = document.getElementById("side-panel-container")