From 76a38bcb0c7810333fdc14833cc462e7909e330e Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Thu, 9 May 2024 21:36:38 +0530 Subject: [PATCH 1/2] Add simple token spacing application --- common/src/app/common/types/token.cljc | 2 ++ frontend/src/app/main/ui/workspace/tokens/core.cljs | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/types/token.cljc b/common/src/app/common/types/token.cljc index 19d93d932..d9a107054 100644 --- a/common/src/app/common/types/token.cljc +++ b/common/src/app/common/types/token.cljc @@ -89,6 +89,8 @@ [:position-x {:optional true} ::sm/uuid] [:position-y {:optional true} ::sm/uuid]]) +(def spacing-keys (schema-keys ::spacing)) + (sm/def! ::tokens [:map {:title "Applied Tokens"}]) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 1657504cb..5e25e3608 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -10,8 +10,11 @@ [app.common.types.shape.radius :as ctsr] [app.common.types.token :as ctt] [app.main.data.workspace.changes :as dch] + [app.main.data.workspace.shape-layout :as dwsl] + [app.main.data.workspace.state-helpers :as wsh] [app.main.data.workspace.transforms :as dwt] - [app.main.store :as st])) + [app.main.store :as st] + [beicon.v2.core :as rx])) ;; Helpers --------------------------------------------------------------------- @@ -45,6 +48,11 @@ (dwt/update-dimensions shape-ids :width value) (dwt/update-dimensions shape-ids :height value))) +(defn update-layout-spacing-column [value shape-ids] + (let [selected-shapes (wsh/lookup-selected @st/state)] + (st/emit! + (dwsl/update-layout selected-shapes {:layout-gap {:column-gap value :row-gap value}})))) + ;; Token types ----------------------------------------------------------------- (def token-types @@ -100,6 +108,8 @@ :key :rotation}]}}] [:spacing {:title "Spacing" + :attributes ctt/spacing-keys + :on-update-shape update-layout-spacing-column :modal {:key :tokens/spacing :fields [{:label "Spacing" :key :spacing}]}}] From 0c856702c684e5ccb1caf071fde06a14f6260e6a Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Fri, 10 May 2024 08:36:40 +0200 Subject: [PATCH 2/2] Remove unneeded import --- frontend/src/app/main/ui/workspace/tokens/core.cljs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 5e25e3608..08b7dc988 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -13,8 +13,7 @@ [app.main.data.workspace.shape-layout :as dwsl] [app.main.data.workspace.state-helpers :as wsh] [app.main.data.workspace.transforms :as dwt] - [app.main.store :as st] - [beicon.v2.core :as rx])) + [app.main.store :as st])) ;; Helpers ---------------------------------------------------------------------