adds an empty state if there is no datasource selected.
This commit is contained in:
parent
1a0b8c6a8c
commit
479ea07e92
|
@ -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>
|
Loading…
Reference in New Issue