0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Merge pull request #116 from tokens-studio/spacing-token-layout-update

spacing token to update only row or column gap as per flex direction
This commit is contained in:
Akshay Gupta 2024-05-21 13:28:34 +05:30 committed by GitHub
commit cb7d4409e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -101,10 +101,15 @@
(when (seq (:strokes shape))
(assoc-in shape [:strokes 0 :stroke-width] 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}}))))
(defn update-layout-spacing-column [value shape-ids]
(doseq [shape-id shape-ids]
(let [shape (dt/get-shape-from-state shape-id @st/state)
layout-direction (:layout-flex-dir shape)
layout-update (if (or (= layout-direction :row-reverse) (= layout-direction :row))
{:layout-gap {:column-gap value}}
{:layout-gap {:row-gap value}})]
(st/emit!
(dwsl/update-layout [shape-id] layout-update)))))
;; Token types -----------------------------------------------------------------