diff options
author | Joris | 2016-09-04 21:21:11 +0200 |
---|---|---|
committer | Joris | 2016-09-04 21:21:31 +0200 |
commit | 973a039b54327df74396605410ea9abe19c8a4e7 (patch) | |
tree | c702564d17e0a490d56845027238eb4f231be785 /src/View.elm | |
parent | 62fee9133f36f655c1ed83e0c2e85394f9948bf5 (diff) |
Upgrade to elm 0.17.1
Diffstat (limited to 'src/View.elm')
-rw-r--r-- | src/View.elm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/View.elm b/src/View.elm new file mode 100644 index 0000000..5b3ad8d --- /dev/null +++ b/src/View.elm @@ -0,0 +1,56 @@ +module View exposing + ( view + ) + +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import List +import Dict +import Json.Decode as Json + +import Msg exposing (Msg) + +import Model exposing (..) +import Model.Id exposing (..) + +import Timer.Model exposing (..) +import Timer.View as Timer + +import Update exposing (..) + +view : Model -> Html Msg +view model = + div + [] + [ title + , model.timers + |> Dict.toList + |> List.sortBy (.creationTime << snd) + |> timers model + ] + +title : Html Msg +title = + div + [ class "headerBar" ] + [ button + [ onClick Msg.Initialize + , class "title" + ] + [ text "Timer" ] + , button + [ onClick Msg.AddNewTimer + , class "addTimer" + ] + [ i + [ class "fa fa-fw fa-plus" ] + [] + ] + ] + +timers : Model -> List (Id, Timer) -> Html Msg +timers model timers = + div + [ class "timers" ] + (List.map (Timer.view model) timers) |