fix bugs in page
This commit is contained in:
1 parent
6ed638a1cc
commit
e654fdfea6
387 files changed
+13618
-88879
No files matched your search
@@ -0,0 +1,41 @@
|
||||
(ns website.core
|
||||
(:require [reagent.core :as reagent :refer [atom]]
|
||||
[secretary.core :as secretary :include-macros true]
|
||||
[accountant.core :as accountant]
|
||||
[website.tobbar :refer [topbar]]
|
||||
[website.home :refer [home-page]]))
|
||||
|
||||
|
||||
;; -------------------------
|
||||
;; Routes
|
||||
|
||||
(defonce page (atom #'home-page))
|
||||
|
||||
(defn current-page []
|
||||
[:div
|
||||
[topbar]
|
||||
[:div.columns
|
||||
[:div.column.is-offset-1.is-10
|
||||
[:br]
|
||||
[@page]]]])
|
||||
|
||||
(secretary/defroute "/" []
|
||||
(reset! page #'home-page))
|
||||
|
||||
|
||||
;; -------------------------
|
||||
;; Initialize app
|
||||
|
||||
(defn mount-root []
|
||||
(reagent/render [current-page] (.getElementById js/document "app")))
|
||||
|
||||
(defn init! []
|
||||
(accountant/configure-navigation!
|
||||
{:nav-handler
|
||||
(fn [path]
|
||||
(secretary/dispatch! path))
|
||||
:path-exists?
|
||||
(fn [path]
|
||||
(secretary/locate-route path))})
|
||||
(accountant/dispatch-current!)
|
||||
(mount-root))
|
||||
Reference in new issue
Block a user