/ui.cljs Secret
Created
June 27, 2016 12:33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defui ^:once NavSidebar ...) | |
(def nav-sidebar (om/factory NavSidebar)) | |
(defui ^:once LoadingIndicator | |
static om/IQuery | |
(query [this] '[[:ui/loading-data _]) | |
Object | |
(render [this] | |
(let [{:keys [:ui/loading-data]} (om/props this)] | |
(dom/i #js {:className (str "fa fa-spinner" (when loading-data " fa-spin"))} | |
"")))) | |
(def loading-indicator (om/factory LoadingIndicator)) | |
(defui ^:once TopBar | |
static om/IQuery | |
(query [this] `[[:ui/app-version _] ~@(om/get-query LoadingIndicator)]) | |
Object | |
(render [this] | |
(let [{:keys [ui/app-version]} (om/props this)] | |
(dom/div #js {:className "nav navbar-default navbar-static-top"} | |
(dom/div #js {:className "navbar-header"} | |
(dom/button #js {:className "navbar-toggle" :type "button"}) | |
(dom/a #js {:className "navbar-brand" :href "#"} | |
(str "My-App " app-version) | |
(loading-indicator))) | |
(nav-sidebar))))) | |
(def top-bar (om/factory TopBar)) | |
(defui ^:once Root | |
static uc/InitialAppState | |
(initial-state [clz params] {:ui/react-key "ROOT" | |
:ui/app-version "2016.04"}) | |
static om/IQuery | |
(query [this] `[:ui/react-key :ui/loading-data ~@(om/get-query TopBar)]) | |
Object | |
(render [this] | |
(let [{:keys [ui/react-key ui/loading-data]} (om/props this)] | |
(dom/div #js {:key (or react-key "ROOT") :id "wrapper"} | |
(top-bar) | |
(dom/h1 nil | |
(str "MY.APP" (when loading-data " (LOADING) "))) | |
)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment