57 lines
719 B
Elm
57 lines
719 B
Elm
module Main exposing (..)
|
|
|
|
import Browser
|
|
import Html exposing (Html, button, div, text)
|
|
import Html.Events exposing (onClick)
|
|
import Track exposing (Track)
|
|
|
|
-- MAIN
|
|
|
|
|
|
main =
|
|
Browser.sandbox { init = init, update = update, view = view }
|
|
|
|
|
|
|
|
-- MODEL
|
|
|
|
|
|
type alias Model = Track
|
|
|
|
|
|
init : Model
|
|
init =
|
|
Track.read "hello"
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
type Msg
|
|
= Increment
|
|
| Decrement
|
|
|
|
|
|
update : Msg -> Model -> Model
|
|
update msg model =
|
|
case msg of
|
|
Increment ->
|
|
model
|
|
|
|
Decrement ->
|
|
model
|
|
|
|
|
|
|
|
-- VIEW
|
|
|
|
|
|
view : Model -> Html Msg
|
|
view model =
|
|
div []
|
|
[ button [ onClick Decrement ] [ text "-" ]
|
|
, div [] [ text (String.fromInt (List.length model)) ]
|
|
, button [ onClick Increment ] [ text "+" ]
|
|
]
|