Created
August 9, 2016 21:15
-
-
Save knewter/cd615a8c539a45a0f832e090f8d58b78 to your computer and use it in GitHub Desktop.
Introduction to elm-mdl - 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Msg | |
-- ... | |
| SelectTab Int | |
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
-- ... | |
SelectTab num -> | |
let | |
_ = | |
Debug.log "SelectTab: " num | |
in | |
model ! [] | |
view : Model -> Html Msg | |
view model = | |
Layout.render Mdl | |
model.mdl | |
[ Layout.fixedHeader | |
, Layout.onSelectTab SelectTab -- <-- Add this | |
] | |
{ header = [ h1 [ style [ ( "padding", "2rem" ) ] ] [ text "Counter" ] ] | |
, drawer = [] | |
, tabs = ( [ text "Milk", text "Oranges" ], [] ) | |
, main = [ viewBody model ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment