Created
February 28, 2013 17:08
-
-
Save gtrak/5058291 to your computer and use it in GitHub Desktop.
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
(defn set-style | |
[elt property value] | |
(doto (.-style elt) | |
(.setProperty property value)) | |
elt) | |
(defn set-styles | |
[elt s] | |
(let [style (.-style elt)] | |
(doseq [[property value] s] | |
(.setProperty style property value)) | |
elt)) | |
(defn set-dim | |
[elt width height] | |
(if width | |
(set-style elt "width" (str width "px"))) | |
(if height | |
(set-style elt "height" (str height "px"))) | |
elt) | |
(defn flat-button | |
[text & [width height]] | |
(let [b (doto (goog.ui.Button. (str text) (flatbr/getInstance)) | |
(.render (top))) | |
elt (.getContentElement b)] | |
(set-dim elt width height))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment