diff options
author | William Carroll <wpcarro@gmail.com> | 2020-04-11T16·46+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-04-11T16·46+0100 |
commit | c24c9b7fb940793ef75fa61d00abb31c3d56f94b (patch) | |
tree | 2a55a46e1d3efc3a6db0faf55a91b363e7c6faec /website/sandbox/chord-drill-sergeant/src/Tempo.elm | |
parent | e864074600bddf14c6f75bdd683d794705b22367 (diff) |
Support BPM for tempo
Using BPM as the unit for tempo. TODO: Consider a higher-fidelity way to calculate BPM, although I'm not sure this is critical functionality; an interesting problem is just seducing me, and this app would be better off resisting the temptation.
Diffstat (limited to 'website/sandbox/chord-drill-sergeant/src/Tempo.elm')
-rw-r--r-- | website/sandbox/chord-drill-sergeant/src/Tempo.elm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/website/sandbox/chord-drill-sergeant/src/Tempo.elm b/website/sandbox/chord-drill-sergeant/src/Tempo.elm new file mode 100644 index 000000000000..de4fa32795f9 --- /dev/null +++ b/website/sandbox/chord-drill-sergeant/src/Tempo.elm @@ -0,0 +1,22 @@ +module Tempo exposing (render) + +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) + +type alias Props msg = + { tempo : Int + , handleIncrease : msg + , handleDecrease : msg + , handleInput : String -> msg + } + +render : Props msg -> Html msg +render {tempo, handleIncrease, handleDecrease, handleInput} = + div [] [ p [] [ text ((String.fromInt tempo) ++ " BPM") ] + , button [ onClick handleDecrease ] [ text "Slower" ] + , input [ onInput handleInput + , placeholder "Set tempo..." + ] [] + , button [ onClick handleIncrease ] [ text "Faster" ] + ] |