From c132ea1d67d16a19a1853f30f9beaeb74f7c9c3c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 25 Dec 2015 22:20:04 +0200 Subject: [PATCH] Improve render function for builtin icons. --- frontend/uxbox/shapes.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/uxbox/shapes.cljs b/frontend/uxbox/shapes.cljs index 94e05e4017..582d4c78a9 100644 --- a/frontend/uxbox/shapes.cljs +++ b/frontend/uxbox/shapes.cljs @@ -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])))