You can use Config objects for both the update and view functions from each page and just lift everything to the top message. I have commented on your gist with how this would look.
Please note that I have removed the Navigate cmd from your Pages, if you want, you can put it back. I also added a couple of typed Cmds to show how to use the lift in `update` On Tue, Jan 24, 2017 at 5:31 AM, Maksim Demin <[email protected]> wrote: > Hi, > > I am trying to figure out the best way to build up pages that have very > little in common, but need to share something, i.e. a nav bar. The pages > don't share messages or models, what would be the best way to implement a > nav across both pages, and perhaps more pages in the future. > > I came up with two approaches. > > The first is to put the navigation messages at the top Msg and have all > the pages map their Html to return the top level Msg's. I think this is > cool because it avoids replicating the messages across the pages, but you > end up with a bunch of Html.maps to convert everything to the top level Msg > (The docs say "This should not come in handy too often." which got me > thinking of how else to do this) . > > The second approach is to have each page implement all the messages for > the nav and in the pages respective update. This seems like a bunch of > duplication as the nav grows and does not seem like a good approach. > > Is there a better way to do this kind of thing? > > Here is some example code of what I mean https://gist.github.com/ > mdemin914/0baf793dce856ffe57ce31979ad600d6. > > Any thoughts are appreciated. > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
