Skip to content

Instantly share code, notes, and snippets.

@curtosis
Created June 27, 2016 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curtosis/395a2406ed07c81304aeefcb77eaf333 to your computer and use it in GitHub Desktop.
Save curtosis/395a2406ed07c81304aeefcb77eaf333 to your computer and use it in GitHub Desktop.
(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)]
(untangled.client.logging/debug (str "props: " (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 _] {:indicator (om/get-query LoadingIndicator)}])
Object
(render [this]
(let [{:keys [ui/app-version indicator]} (om/props this)]
(untangled.client.logging/debug (str "app-version: [" app-version "]"))
(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 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 :ui/app-version {:topbar (om/get-query TopBar)}])
Object
(render [this]
(let [{:keys [ui/react-key ui/loading-data ui/app-version topbar]} (om/props this)]
(dom/div #js {:key (or react-key "ROOT") :id "wrapper"}
(top-bar topbar)
(dom/h1 nil
(str "MY.APP" (when app-version (str " <" app-version "> ")) (when loading-data " (LOADING")))
))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment