From eb6269a0bb6359794b3e38d30f72d915f29aeaa9 Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 30 Aug 2023 09:27:23 +0100 Subject: [PATCH] Refactor theme binding into device databindings fn --- .../builder/src/builderStore/dataBinding.js | 43 ++++++++++++------- .../Component/ComponentSettingsPanel.svelte | 33 +++----------- .../context/DeviceBindingsProvider.svelte | 2 - 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 20172e4f9c..0510cff07d 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -497,22 +497,33 @@ const getDeviceBindings = () => { let bindings = [] if (get(store).clientFeatures?.deviceAwareness) { const safeDevice = makePropSafe("device") - bindings.push({ - type: "context", - runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, - readableBinding: `Device.Mobile`, - category: "Device", - icon: "DevicePhone", - display: { type: "boolean", name: "mobile" }, - }) - bindings.push({ - type: "context", - runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, - readableBinding: `Device.Tablet`, - category: "Device", - icon: "DevicePhone", - display: { type: "boolean", name: "tablet" }, - }) + + bindings = [ + { + type: "context", + runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, + readableBinding: `Device.Mobile`, + category: "Device", + icon: "DevicePhone", + display: { type: "boolean", name: "mobile" }, + }, + { + type: "context", + runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, + readableBinding: `Device.Tablet`, + category: "Device", + icon: "DevicePhone", + display: { type: "boolean", name: "tablet" }, + }, + { + type: "context", + runtimeBinding: `${safeDevice}.${makePropSafe("theme")}`, + readableBinding: `App.Theme`, + category: "Device", + icon: "DevicePhone", + display: { type: "string", name: "App Theme" }, + }, + ] } return bindings } diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte index 073160dc67..afcada4138 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte @@ -1,11 +1,6 @@