mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 11:59:17 -05:00
Merge pull request #80 from tokens-studio/add-spacing-function
Add simple token spacing application
This commit is contained in:
commit
d81b1f328d
2 changed files with 11 additions and 0 deletions
|
@ -89,6 +89,8 @@
|
||||||
[:position-x {:optional true} ::sm/uuid]
|
[:position-x {:optional true} ::sm/uuid]
|
||||||
[:position-y {:optional true} ::sm/uuid]])
|
[:position-y {:optional true} ::sm/uuid]])
|
||||||
|
|
||||||
|
(def spacing-keys (schema-keys ::spacing))
|
||||||
|
|
||||||
(sm/def! ::tokens
|
(sm/def! ::tokens
|
||||||
[:map {:title "Applied Tokens"}])
|
[:map {:title "Applied Tokens"}])
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
[app.common.types.shape.radius :as ctsr]
|
[app.common.types.shape.radius :as ctsr]
|
||||||
[app.common.types.token :as ctt]
|
[app.common.types.token :as ctt]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[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.data.workspace.transforms :as dwt]
|
||||||
[app.main.store :as st]))
|
[app.main.store :as st]))
|
||||||
|
|
||||||
|
@ -45,6 +47,11 @@
|
||||||
(dwt/update-dimensions shape-ids :width value)
|
(dwt/update-dimensions shape-ids :width value)
|
||||||
(dwt/update-dimensions shape-ids :height 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 -----------------------------------------------------------------
|
;; Token types -----------------------------------------------------------------
|
||||||
|
|
||||||
(def token-types
|
(def token-types
|
||||||
|
@ -100,6 +107,8 @@
|
||||||
:key :rotation}]}}]
|
:key :rotation}]}}]
|
||||||
[:spacing
|
[:spacing
|
||||||
{:title "Spacing"
|
{:title "Spacing"
|
||||||
|
:attributes ctt/spacing-keys
|
||||||
|
:on-update-shape update-layout-spacing-column
|
||||||
:modal {:key :tokens/spacing
|
:modal {:key :tokens/spacing
|
||||||
:fields [{:label "Spacing"
|
:fields [{:label "Spacing"
|
||||||
:key :spacing}]}}]
|
:key :spacing}]}}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue