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

Add tokens map generators

This commit is contained in:
Florian Schroedl 2024-05-15 18:20:28 +02:00
parent 5e301605ad
commit d9dbaad281

View file

@ -43,6 +43,17 @@
(->> (vals tokens)
(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 ------------------------------------------------------------
(defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}]