Merge branch 'master' of github.com:Budibase/budibase into component-binding-refactor

This commit is contained in:
Andrew Kingston 2021-01-22 11:07:27 +00:00
commit 4188761ea6
3 changed files with 36 additions and 11 deletions

View File

@ -33,7 +33,7 @@
$builderStore.previewType === "layout" || screenslotContext $builderStore.previewType === "layout" || screenslotContext
// Update component context // Update component context
$: componentStore.set({ id, styles: { ...styles, id, allowSelection } }) $: componentStore.set({ id, children: children.length, styles: { ...styles, id, allowSelection } })
// Updates the component props. // Updates the component props.
// Most props are deeply compared so that svelte will only trigger reactive // Most props are deeply compared so that svelte will only trigger reactive

View File

@ -1,13 +1,20 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
// Add this back once we can define specific design options to expose const { styleable } = getContext("sdk")
// const { styleable } = getContext("sdk") const component = getContext("component")
// const component = getContext("component")
export let icon = "" export let icon = ""
export let size = "fa-lg" export let size = "fa-lg"
export let color = "#000" export let color = "#f00"
$: styles = {
...$component.styles,
normal: {
...$component.styles.normal,
color,
},
}
</script> </script>
<i style={`color: ${color};`} class={`${icon} ${size}`} /> <i use:styleable={styles} class="{icon} {size}" />

View File

@ -19,9 +19,27 @@
</script> </script>
<div use:styleable={$component.styles}> <div use:styleable={$component.styles}>
{#if rows.length > 0}
{#each rows as row} {#each rows as row}
<DataProvider {row}> <DataProvider {row}>
{#if $component.children === 0}
<p>Add some components too.</p>
{:else}
<slot /> <slot />
{/if}
</DataProvider> </DataProvider>
{/each} {/each}
{:else}
<p>Feed me some data</p>
{/if}
</div> </div>
<style>
p {
display: grid;
place-items: center;
background: #f5f5f5;
border: #ccc 1px solid;
padding: var(--spacing-m);
}
</style>