Skip to content

Instantly share code, notes, and snippets.

@kingsleyh
Last active March 14, 2017 21:37
Show Gist options
  • Save kingsleyh/8c094accfff98ad6360d60454aef2518 to your computer and use it in GitHub Desktop.
Save kingsleyh/8c094accfff98ad6360d60454aef2518 to your computer and use it in GitHub Desktop.
Elm
module Boards.Messages exposing (..)
type Msg
= NoOp
module Boards.View exposing (..)
nav : Boards -> Html Msg
nav model =
Html.map (\_ -> NoOp) (Nav.View.viewNav model.navBar)
view : Boards -> Html Msg
view model =
div [] [ nav model ]
module Messages exposing (..)
type Msg
= NavMsg Nav.Messages.Msg
| BoardsMsg Boards.Messages.Msg
module Nav.Messages exposing (..)
type Msg
= NoOp
| GetNavBoards String
| NavBoardsResponse (Result Http.Error (ApiResponseList NavBoard))
module Nav.View exposing (..)
viewNav : NavModel -> Html Msg
viewNav model =
div [] [ text "NAV"]
module Update exposing (..)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
BoardsMsg subMsg ->
let
( updatedBoards, cmd) =
Boards.Update.update subMsg model.boards
in
( { model | boards = updatedBoards }, Cmd.batch Cmd.map BoardsMsg cmd)
NavMsg subMsg ->
let
( updatedNav, cmd ) =
Nav.Update.update subMsg model.navBar
in
Debug.log "Nav main update"
( { model | navBar = updatedNav }, Cmd.map NavMsg cmd )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment