Define a viewer-page component using new defc syntax.

This commit is contained in:
Andrey Antukh 2016-07-09 16:38:24 +03:00
parent 52e1021cfb
commit aae868dba8
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -14,7 +14,7 @@
[uxbox.util.i18n :refer (tr)] [uxbox.util.i18n :refer (tr)]
[uxbox.util.rstore :as rs] [uxbox.util.rstore :as rs]
[uxbox.util.router :as rt] [uxbox.util.router :as rt]
[uxbox.util.mixins :as mx] [uxbox.util.mixins :as mx :include-macros true]
[uxbox.main.ui.icons :as i] [uxbox.main.ui.icons :as i]
[uxbox.main.state :as st] [uxbox.main.state :as st]
[uxbox.view.data.viewer :as dv] [uxbox.view.data.viewer :as dv]
@ -47,21 +47,15 @@
(remove-watch token-ref ::wkey) (remove-watch token-ref ::wkey)
own) own)
(defn viewer-page-render (mx/defc viewer-page
{:mixins [mx/static rum/reactive]
:will-unmount viewer-page-will-unmount
:will-mount viewer-page-will-mount}
[own] [own]
(let [flags (rum/react flags-ref) (let [flags (rum/react flags-ref)
sitemap? (contains? flags :sitemap)] sitemap? (contains? flags :sitemap)]
(html
[:section.view-content [:section.view-content
(when sitemap? (when sitemap?
(sitemap)) (sitemap))
(nav flags) (nav flags)
(canvas)]))) (canvas)]))
(def viewer-page
(mx/component
{:render viewer-page-render
:will-mount viewer-page-will-mount
:will-unmount viewer-page-will-unmount
:name "viewer-page"
:mixins [mx/static rum/reactive]}))