2020-04-11 18:46:46 +02:00
|
|
|
module Tempo exposing (render)
|
|
|
|
|
|
|
|
import Html exposing (..)
|
|
|
|
import Html.Attributes exposing (..)
|
|
|
|
import Html.Events exposing (..)
|
|
|
|
|
2020-04-12 17:43:34 +02:00
|
|
|
|
2020-04-11 18:46:46 +02:00
|
|
|
type alias Props msg =
|
2020-04-12 17:43:34 +02:00
|
|
|
{ tempo : Int
|
|
|
|
, handleIncrease : msg
|
|
|
|
, handleDecrease : msg
|
|
|
|
, handleInput : String -> msg
|
|
|
|
}
|
|
|
|
|
2020-04-11 18:46:46 +02:00
|
|
|
|
|
|
|
render : Props msg -> Html msg
|
2020-04-12 17:43:34 +02:00
|
|
|
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" ]
|
|
|
|
]
|