adds an empty state if there is no datasource selected.

This commit is contained in:
kevmodrome 2021-01-19 15:11:21 +01:00
parent cbaffe798a
commit d4b27f7bc4
1 changed files with 20 additions and 5 deletions

View File

@ -4,6 +4,7 @@
const { API, styleable, DataProvider } = getContext("sdk")
const component = getContext("component")
console.log($component)
const dataContext = getContext("data")
export let datasource = []
@ -24,9 +25,23 @@
</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}>
<slot />
</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>