Don't apply new container layout settings unless props have been defined, so that existing containers are unchanged

This commit is contained in:
Andrew Kingston 2021-06-10 09:28:10 +01:00
parent 383e6793ec
commit c17550d0c6
1 changed files with 12 additions and 14 deletions

View File

@ -4,22 +4,21 @@
const { styleable, transition, builderStore } = getContext("sdk") const { styleable, transition, builderStore } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
export let direction = "column" export let direction
export let hAlign = "left" export let hAlign
export let vAlign = "top" export let vAlign
export let size = "shrink" export let size
let element let element
$: directionClass = direction ? `direction-${direction}` : ""
$: hAlignClass = hAlign ? `hAlign-${hAlign}` : ""
$: vAlignClass = vAlign ? `vAlign-${vAlign}` : ""
$: sizeClass = size ? `size-${size}` : ""
</script> </script>
<div <div
class={` class={[directionClass, hAlignClass, vAlignClass, sizeClass].join(" ")}
container
hAlign-${hAlign}
vAlign-${vAlign}
direction-${direction}
size-${size}
`}
class:empty={!$component.children && $builderStore.inBuilder} class:empty={!$component.children && $builderStore.inBuilder}
class:selected={$component.selected} class:selected={$component.selected}
in:transition={{ type: $component.transition }} in:transition={{ type: $component.transition }}
@ -34,16 +33,15 @@
</div> </div>
<style> <style>
.container {
display: flex;
}
.empty { .empty {
border: 2px dashed rgba(0, 0, 0, 0.25); border: 2px dashed rgba(0, 0, 0, 0.25);
} }
.direction-row { .direction-row {
display: flex;
flex-direction: row; flex-direction: row;
} }
.direction-column { .direction-column {
display: flex;
flex-direction: column; flex-direction: column;
} }