0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

Improve render function for builtin icons.

This commit is contained in:
Andrey Antukh 2015-12-25 22:20:04 +02:00
parent a4b286888e
commit c132ea1d67

View file

@ -6,7 +6,12 @@
(:type shape)))
(defmethod render :builtin/icon
[shape & [{:keys [width height] :or {width "500" height "500"}}]]
(let [content (:svg shape)]
[{:keys [data width height view-box]} & [attrs]]
(let [attrs (merge
(when width {:width width})
(when height {:height height})
(when view-box {:viewBox (apply str (interpose " " view-box))})
attrs)]
(html
[:svg {:width width :height height} content])))
[:svg attrs data])))