From ae263363ed8d9232e034f1577e9bdd7b2bed19dc Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Thu, 9 May 2024 21:36:38 +0530 Subject: [PATCH] Add opacity --- common/src/app/common/types/token.cljc | 6 ++++++ frontend/src/app/main/ui/workspace/tokens/core.cljs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/types/token.cljc b/common/src/app/common/types/token.cljc index d9a107054..7ee478bc5 100644 --- a/common/src/app/common/types/token.cljc +++ b/common/src/app/common/types/token.cljc @@ -77,6 +77,12 @@ (def dimensions-keys (schema-keys ::dimensions)) +(sm/def! ::opacity + [:map + [:opacity ::sm/uuid]]) + +(def opacity-keys (schema-keys ::opacity)) + (sm/def! ::spacing [:map [:spacing-column {:optional true} ::sm/uuid] diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 74b949b21..551130a7d 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -67,8 +67,12 @@ (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)] +(defn update-opacity [value shape-ids] + (st/emit! + (dch/update-shapes shape-ids #(assoc % :opacity 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}})))) @@ -112,6 +116,8 @@ :key :numeric}]}}] [:opacity {:title "Opacity" + :attributes ctt/opacity-keys + :on-update-shape update-opacity :modal {:key :tokens/opacity :fields [{:label "Opacity" :key :opacity}]}}]