initial commit
This commit is contained in:
36
client/elm/Loading.elm
Normal file
36
client/elm/Loading.elm
Normal file
@@ -0,0 +1,36 @@
|
||||
module Loading exposing (..)
|
||||
|
||||
import Html as H exposing (Html)
|
||||
import Html.Attributes as HA
|
||||
import Html.Events as HE
|
||||
|
||||
|
||||
type alias Model =
|
||||
Int
|
||||
|
||||
|
||||
type Msg
|
||||
= Dec
|
||||
| Inc
|
||||
|
||||
|
||||
init =
|
||||
0
|
||||
|
||||
|
||||
view mdl =
|
||||
H.div []
|
||||
[ H.button [ HE.onClick Dec ] [ H.text "-" ]
|
||||
, H.button [ HE.onClick Inc ] [ H.text "+" ]
|
||||
, H.text <| String.fromInt mdl
|
||||
]
|
||||
|
||||
|
||||
update : Msg -> Model -> Model
|
||||
update msg mdl =
|
||||
case msg of
|
||||
Dec ->
|
||||
mdl - 1
|
||||
|
||||
Inc ->
|
||||
mdl + 1
|
||||
Reference in New Issue
Block a user