Merge pull request #1002 from Budibase/feature/repeater-placeholder

Adds empty states to the repeater component
This commit is contained in:
Kevin Åberg Kultalahti 2021-01-22 10:13:18 +01:00 committed by GitHub
commit 497feb80d6
2 changed files with 24 additions and 6 deletions

View File

@ -29,7 +29,7 @@
$builderStore.previewType === "layout" || screenslotContext
// Update component context
$: componentStore.set({ id, styles: { ...styles, id, allowSelection } })
$: componentStore.set({ id, children: children.length, styles: { ...styles, id, allowSelection } })
// Gets the component constructor for the specified component
const getComponentConstructor = component => {

View File

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