mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
Add tokens map generators
This commit is contained in:
@@ -43,6 +43,17 @@
|
|||||||
(->> (vals tokens)
|
(->> (vals tokens)
|
||||||
(group-by :type)))
|
(group-by :type)))
|
||||||
|
|
||||||
|
(defn tokens-name-map
|
||||||
|
"Convert tokens into a map with their `:name` as the key."
|
||||||
|
[tokens]
|
||||||
|
(->> (map (fn [{:keys [name] :as token}] [name token]) tokens)
|
||||||
|
(into {})))
|
||||||
|
|
||||||
|
(defn tokens-name-map-for-type [token-type tokens]
|
||||||
|
(-> (group-tokens-by-type tokens)
|
||||||
|
(get token-type [])
|
||||||
|
(tokens-name-map)))
|
||||||
|
|
||||||
;; Update functions ------------------------------------------------------------
|
;; Update functions ------------------------------------------------------------
|
||||||
|
|
||||||
(defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}]
|
(defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}]
|
||||||
|
|||||||
Reference in New Issue
Block a user