Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 624 Bytes

README.md

File metadata and controls

28 lines (22 loc) · 624 Bytes

A collection of helpers for dealing with elm-mdl render functions. This is motivated by the following observations:

  • The triplet of Mdl index model.mdl occurs frequently in elm-mdl.
  • Dealing with indices is a bit tedious.
viewButton model index =
    Button.render Mdl (0 :: index) model.mdl
        [ Button.onClick Increment ]
        [ text "Add" ]

This becomes

viewButton context model =
    (Button.render |> withIndex context 0)
        [ Button.onClick Increment ]
        [ text "Add" ]

There is a simple example with a couple of counters:

$ cd example
$ elm-make App.elm