From d4b27f7bc4d66642e47a7d95ef81f7149d3684a2 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Tue, 19 Jan 2021 15:11:21 +0100 Subject: [PATCH 1/4] adds an empty state if there is no datasource selected. --- packages/standard-components/src/List.svelte | 25 ++++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/standard-components/src/List.svelte b/packages/standard-components/src/List.svelte index 1a5638404a..f02b5e73c8 100644 --- a/packages/standard-components/src/List.svelte +++ b/packages/standard-components/src/List.svelte @@ -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 @@
- {#each rows as row} - - - - {/each} + {#if rows.length > 0} + {#each rows as row} + + + + {/each} + {:else} +

Feed me some data

+ {/if}
+ + \ No newline at end of file From 84450d03233321a2478342e69a8b96436f3b485e Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Tue, 19 Jan 2021 15:21:23 +0100 Subject: [PATCH 2/4] adds a empty state for no components added in the repeater --- packages/client/src/components/Component.svelte | 2 +- packages/standard-components/src/List.svelte | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 23ba364dfb..7361573efd 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -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 => { diff --git a/packages/standard-components/src/List.svelte b/packages/standard-components/src/List.svelte index f02b5e73c8..6c60c62c6f 100644 --- a/packages/standard-components/src/List.svelte +++ b/packages/standard-components/src/List.svelte @@ -28,7 +28,11 @@ {#if rows.length > 0} {#each rows as row} - + {#if $component.children === 0} +

Add some components to.

+ {:else} + + {/if}
{/each} {:else} From 702be7aa1e4211bcbd57968d5f832c2a58422e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Fri, 22 Jan 2021 09:59:38 +0100 Subject: [PATCH 3/4] remove log --- packages/standard-components/src/List.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/standard-components/src/List.svelte b/packages/standard-components/src/List.svelte index 6c60c62c6f..e0c0110ffd 100644 --- a/packages/standard-components/src/List.svelte +++ b/packages/standard-components/src/List.svelte @@ -4,7 +4,6 @@ const { API, styleable, DataProvider } = getContext("sdk") const component = getContext("component") - console.log($component) const dataContext = getContext("data") export let datasource = [] From a62938ee161e3826c9b087305990bcc7cbb37078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Fri, 22 Jan 2021 10:05:49 +0100 Subject: [PATCH 4/4] fix typo --- packages/standard-components/src/List.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/standard-components/src/List.svelte b/packages/standard-components/src/List.svelte index e0c0110ffd..809abf2972 100644 --- a/packages/standard-components/src/List.svelte +++ b/packages/standard-components/src/List.svelte @@ -28,7 +28,7 @@ {#each rows as row} {#if $component.children === 0} -

Add some components to.

+

Add some components too.

{:else} {/if}