Created
October 21, 2015 12:44
-
-
Save treejamie/6dc7d749236f91259120 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
(ns simple.core | |
(:require [reagent.core :as r])) | |
(defonce weight (r/atom 40)) | |
(defonce reps (r/atom 5)) | |
(defn calculate-repmax [w r] | |
; do things | |
()) | |
(defn hello-world-component [] | |
[:div | |
[:p "I want to say to you!"] | |
[:p.someclass | |
"HELLO " [:strong "bold"] | |
[:span {:style {:color "red"}} " WORLD "]]]) | |
(defn title-component [] | |
[:h1 "ONE REP MAX CALCULATOR"]) | |
(defn calculator-component [] | |
[:div {:class "calc"} | |
[:div {:class "weight"} | |
[:input {:placeholder "weight" | |
:on-change calculate-repmax | |
:value @weight | |
:type "number"}]] | |
[:div {:class "times"} | |
[:span "×"]] | |
[:div {:class "reps"} | |
[:input {:placeholder "reps" | |
:value @reps | |
;:on-change (-> (reset! weight )) | |
:on-change (fn [e]( reset! reps #(-> e .-target .-value ))) | |
:type "number"}]] | |
[:p {:class "result"} [calculate-repmax @weight @reps]]]) | |
(defn one-rep-max-component [] | |
[:div | |
[title-component] | |
[calculator-component]]) | |
(defn render! [] | |
(r/render [one-rep-max-component] | |
(js/document.getElementById "app"))) | |
(render!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment