From 1bc6f30b6c08982dca05bf54503f7ed6394316d0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 12 Sep 2022 08:50:22 +0100 Subject: [PATCH 1/4] Fix component empty state and invalid state styling --- .../client/src/components/Component.svelte | 4 ++- .../app/ComponentPlaceholder.svelte | 29 +++++++++---------- .../src/components/app/DataProvider.svelte | 6 +--- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index a7f506a387..491b58c4c5 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -127,7 +127,9 @@ // Empty components are those which accept children but do not have any. // Empty states can be shown for these components, but can be disabled // in the component manifest. - $: empty = interactive && !children.length && hasChildren + $: empty = + (interactive && !children.length && hasChildren) || + hasMissingRequiredSettings $: emptyState = empty && showEmptyState // Enrich component settings diff --git a/packages/client/src/components/app/ComponentPlaceholder.svelte b/packages/client/src/components/app/ComponentPlaceholder.svelte index 13cc217ef0..7b0a8bbbd9 100644 --- a/packages/client/src/components/app/ComponentPlaceholder.svelte +++ b/packages/client/src/components/app/ComponentPlaceholder.svelte @@ -2,28 +2,25 @@ import { getContext } from "svelte" import { builderStore } from "stores" - const { styleable } = getContext("sdk") const component = getContext("component") $: requiredSetting = $component.missingRequiredSettings?.[0] {#if $builderStore.inBuilder && requiredSetting} -
-
- - Add the {requiredSetting.label} setting to start using your - component - - - { - builderStore.actions.highlightSetting(requiredSetting.key) - }} - > - Show me - -
+
+ + Add the {requiredSetting.label} setting to start using your component + - + + { + builderStore.actions.highlightSetting(requiredSetting.key) + }} + > + Show me +
{/if} diff --git a/packages/client/src/components/app/DataProvider.svelte b/packages/client/src/components/app/DataProvider.svelte index 69b2ccfc82..7967fc77cf 100644 --- a/packages/client/src/components/app/DataProvider.svelte +++ b/packages/client/src/components/app/DataProvider.svelte @@ -133,11 +133,7 @@
{:else} - {#if $component.emptyState} - - {:else} - - {/if} + {#if paginate && $fetch.supportsPagination}