Skip to content

Instantly share code, notes, and snippets.

@ioRekz
Last active July 17, 2017 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ioRekz/22e6ed324ffc516467997fd882f7dd4d to your computer and use it in GitHub Desktop.
Save ioRekz/22e6ed324ffc516467997fd882f7dd4d to your computer and use it in GitHub Desktop.
(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