0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 00:01:51 -05:00

🐛 Use canvas background in viewer

This commit is contained in:
mathieu.brunot 2019-02-21 22:38:54 +01:00
parent 6439d64b72
commit d8838d3fc9
No known key found for this signature in database
GPG key ID: 81584BEAF692D7E0

View file

@ -12,12 +12,13 @@
;; --- Background (Component) ;; --- Background (Component)
(mx/defc background (mx/defc background
[] {:mixins [mx/static]}
[{:keys [background] :as metadata}]
[:rect [:rect
{:x 0 :y 0 {:x 0 :y 0
:width "100%" :width "100%"
:height "100%" :height "100%"
:fill "white"}]) :fill (or background "#ffffff")}])
;; --- Canvas (Component) ;; --- Canvas (Component)
@ -25,12 +26,12 @@
(mx/defc canvas (mx/defc canvas
{:mixins [mx/static]} {:mixins [mx/static]}
[{:keys [metadata] :as page}] [{:keys [metadata id] :as page}]
(let [{:keys [width height]} metadata] (let [{:keys [width height]} metadata]
[:div.view-canvas [:div.view-canvas {:ref (str "canvas" id)}
[:svg.page-layout {:width width [:svg.page-layout {:width width
:height height} :height height}
(background) (background metadata)
(for [id (reverse (:shapes page))] (for [id (reverse (:shapes page))]
(-> (shapes/shape id) (-> (shapes/shape id)
(mx/with-key (str id))))]])) (mx/with-key (str id))))]]))