I’m working on my 2nd app based of rtfeldman/elm-spa-example. It’s a wonderful way to get started and I’m pretty happy how the 1st one turned out. This time I got stuck.
I apologize in advance for assuming familiarity with elm-spa-example. I’m a new user around here so I can’t put in too many links so I’ll try to stick to the most relevant ones
I have a few requirements that require interactivity in my menu bars. For this I need
Html Msg in https://github.com/rtfeldman/elm-spa-example/blob/master/src/Page.elm#L42 and handle those in Main.elm. I’ve been failing at getting it to work while keeping the design, which I’m quite fond of, the same.
So far I’ve tried:
Passing in a Msg defined in Main.elm to Page.view here: https://github.com/rtfeldman/elm-spa-example/blob/master/src/Main.elm#L68. I can’t get this to work with the Html.map that transforms the messages from the pages.
Tried defining Msg in Page.elm directly but I run into the same problem as my first attempt.
I’m now trying to pull out navigation into a separate module similar to
viewErrors in Page.elm and I think that would work. Not sure if I’m liking it though.
I’m a little worried about every Page having to implement/provide all the messages that I’ll need which wouldn’t be too bad I guess. What bothers me more is having to include navigation in the
view of every Page, losing the nice encapsulation provided by Page.elm and viewPage in Main.elm
Has anyone tried something similar and found a nice elegant way to handle this? Am I just overlooking something basic?