0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Merge pull request #80 from tokens-studio/add-spacing-function

Add simple token spacing application
This commit is contained in:
Akshay Gupta 2024-05-10 12:21:38 +05:30 committed by GitHub
commit d81b1f328d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -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"}])

View file

@ -10,6 +10,8 @@
[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]))
@ -45,6 +47,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 +107,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}]}}]