Created
August 1, 2014 06:31
-
-
Save dwwoelfel/0cd3fd778ae008270098 to your computer and use it in GitHub Desktop.
Hack to get something approximating paint rectangles with React/om. Has very rough edges!
This file contains hidden or 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
(defmacro html [body] | |
`(if-not (:render-colors? initial-query-map) | |
(html/html ~body) | |
(let [body# ~body] | |
(try | |
(let [[tag# & rest#] body# | |
attrs# (if (map? (first rest#)) | |
(first rest#) | |
{}) | |
rest# (if (map? (first rest#)) | |
(rest rest#) | |
rest#)] | |
(html/html (vec (concat [tag# (assoc-in attrs# [:style :border] (str "5px solid rgb(" | |
(rand-int 255) | |
"," | |
(rand-int 255) | |
"," | |
(rand-int 255) | |
")"))] | |
rest#)))) | |
(catch :default e# | |
(html/html body#)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of it in action, showing how much extra rendering to the virtual dom we were doing: http://g.recordit.co/bTVTRWEwtZ.gif