 (defn normal-space [x y]
   [:rect {:x (to-scale x) :y (to-scale y) :width (to-scale 40) :height (to-scale 30) :stroke "black" :stroke-width "0.5" :fill "lightgray"}])
 
-(defn space-text [x y s]
-  [:text {:x (to-scale x) :y (to-scale y) :style {:text-anchor "start" :stroke "none" :fill "black" :font-size "small"}} s])
+(defn space-image [x y icon]
+  [:g {:dangerouslySetInnerHTML {:__html (str "<image xlink:href=\"" (icon icon-images) "\" x=\"" (to-scale x) "\" y=\"" (to-scale y) "\" width=\"" (to-scale 30) "\" height=\"" (to-scale 30) "\" />")}}]
+  )
 
 (defn normal-spaces []
   (apply concat

           (when-let [space-data (get-in @app-state [:board i])]
             (let [position (get piece-positions i)
                   space (normal-space (:x position) (:y position))
                   text (space-text (:text-x position) (:text-y position) (name (:icon space-data)))]
               [space text]
               )))))

(defn main-view []


(defn ^:export main []
  (when-let [app (. js/document (getElementById "app"))]
    (reagent/render-component [main-view] app)))

(main)
