Skip to content

Instantly share code, notes, and snippets.

@pbzdyl
Forked from micha/app.cljs.hl
Created May 8, 2017 06:00
Show Gist options
  • Save pbzdyl/2fba434882cb4bd9efb0dc9b78ed429a to your computer and use it in GitHub Desktop.
Save pbzdyl/2fba434882cb4bd9efb0dc9b78ed429a to your computer and use it in GitHub Desktop.
(ns ui.app
(:refer-hoplon :exclude [main body])
(:refer-clojure :exclude [meta])
(:require-macros [ui.app :as app])
(:require [app.routes :as routes]
[app.integrations :as int]
[ui.global-state :as global]))
(def meta html-meta)
(defmethod do! :active
[elem k v]
(elem :class {:active v}))
(defelem main*
[attr kids]
(let [modal-backdrop (div)]
(html
:lang "en"
(head
(link :href (bust-cache "css/application.css") :rel "stylesheet")
(link :href "vendors/jqueryui/jquery-ui.css" :rel "stylesheet")
(link :rel "shortcut icon" :href "favicon.ico" :type "image/x-icon")
(link :rel "icon" :href "favicon.ico" :type "image/x-icon")
(meta :name "viewport" :content "width=device-width, initial-scale=1")
(title :text routes/page-title))
(hoplon.core/body
:class (cell= {:modal-open global/modal-open})
;; clickjacking countermeasures
(if (not= js/top js/self)
(set! (.-location js/top) (.-location js/self))
[kids
(modal-backdrop
:toggle global/modal-open
:class (cell= {:modal-backdrop true
:fade true
:in global/modal-open}))
(int/scripts)])))))
(defelem intercept [attr kids]
((div :class "intercept"
(div :class "intercept-content"
kids))
attr))
(defelem body
[attr kids]
((div :class "body") attr kids))
(defelem app
[attr kids]
((div :class "app") attr kids))
(defelem large-only
[_ kids]
(map #(% :class "large-only") kids))
(defelem small-only
[_ kids]
(map #(% :class "small-only") kids))
(defelem container-fluid
[attr kids]
((div :class "container-fluid") attr kids))
(defelem row
[attr kids]
((div :class "row") attr kids))
(defelem col-md-3
[attr kids]
((div :class "col-md-3") attr kids))
(defelem col-md-6
[attr kids]
((div :class "col-md-6") attr kids))
(defelem col-md-9
[attr kids]
((div :class "col-md-9") attr kids))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment