Last active
July 17, 2017 13:13
-
-
Save ioRekz/22e6ed324ffc516467997fd882f7dd4d to your computer and use it in GitHub Desktop.
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
(require '[reagent.core :as reagent]) | |
(def color | |
(reagent/atom "black")) | |
(def styles | |
{:inputs {:padding "15px"} | |
:inputs-label {:margin-left "5px"} | |
:text {:fontSize "20px"}}) | |
(defn color-item [n] | |
[:label {:style (:inputs styles)} | |
[:input {:type "radio" :name "color" :onClick #(reset! color n)}] | |
[:span {:style (:inputs-label styles)} n]]) | |
(defn color-picker [] | |
[:div | |
[color-item "Chocolate"] | |
[color-item "CornflowerBlue"] | |
[color-item "LightSeaGreen"]]) | |
(defn color-example [] | |
[:div | |
[color-picker] | |
[:p {:style (assoc (:text styles) :color @color)} | |
"My color is dynamic, change it !"]]) | |
(reagent/render [color-example] js/klipse-container) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment