Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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
You can’t perform that action at this time.