0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Convert rect-shape component to use new defc macro.

This commit is contained in:
Andrey Antukh 2016-07-09 21:31:17 +03:00
parent 9b078e19a8
commit 6d82194f9f
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -9,7 +9,7 @@
[rum.core :as rum]
[uxbox.main.ui.shapes.common :as common]
[uxbox.main.ui.shapes.attrs :as attrs]
[uxbox.util.mixins :as mx]
[uxbox.util.mixins :as mx :include-macros true]
[uxbox.main.geom :as geom]
[uxbox.util.dom :as dom]))
@ -38,19 +38,12 @@
;; --- Rect Shape
(defn- rect-shape-render
[own {:keys [id x1 y1 x2 y2] :as shape}]
(mx/defc rect-shape
[{:keys [id x1 y1 x2 y2] :as shape}]
(let [key (str id)
rfm (geom/transformation-matrix shape)
size (geom/size shape)
props {:x x1 :y y1 :id key :key key :transform (str rfm)}
attrs (-> (attrs/extract-style-attrs shape)
(merge props size))]
(html
[:rect attrs])))
(def rect-shape
(mx/component
{:render rect-shape-render
:name "rect-shape"
:mixins [mx/static]}))
[:rect attrs]))