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 1a0b8c6a8c
commit 479ea07e92
No known key found for this signature in database
GPG Key ID: 828D8FE4D235B551
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>