(ns uxbox.shapes
  (:require [sablono.core :refer-macros [html]]))

(defmulti render
  (fn [shape & params]
    (:type shape)))

(defmethod render :builtin/icon
  [shape & [{:keys [width height] :or {width "500" height "500"}}]]
  (let [content (:svg shape)]
    (html
     [:svg {:width width :height height} content])))

(ns uxbox.shapes
  (:require [sablono.core :refer-macros [html]]))

(defmulti render
  (fn [shape & params]
    (:type shape)))

(defmethod render :builtin/icon
  [{: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 attrs data])))

Improve render function for builtin icons.
Improve render function for builtin icons.

studiospring/uxbox,studiospring/uxbox,uxbox/uxbox,studiospring/uxbox,uxbox/uxbox,uxbox/uxbox