I use different layouts in my app, depending on what page is selected.

Something like this:

let
   layoutContent =
      if ((indexToView app.viewSelected) == Overview) then
         layoutOverview
      else
         layoutDefault
in
   Layout.render Mdl
      app.mdl
      (layoutProperties app.viewSelected)
      (layoutContent app)

layoutOverview : App -> Layout.Contents Msg
layoutOverview app =
    { header = viewOverviewHeader
    , drawer = []
    , tabs = ( [], [] )
    , main = [ ... ]
    }


layoutDefault : App -> Layout.Contents Msg
layoutDefault app =
    { header = viewDefaultHeader app
    , drawer = []
    , tabs = ( tabTitles, [ Color.background (Color.color Color.Teal 
Color.S600) ] )
    , main = [ ... ]
    }

Not sure if this meets your needs. layoutOverview and layoutDefault are 
functions that expect the "model" (app) as input. based on the selected 
"view" (page), I select the layout.

If you look at how the elm-mdl demo is implemented, you can see that each 
type alias in the components has a mdl member. You should consider the demo 
implementation as a serious 
reference: https://github.com/debois/elm-mdl/tree/master/demo

Regarding your last question: have you tried it and run into any problems?
best,
Robert



On Tuesday, August 9, 2016 at 12:24:09 PM UTC+2, surfncode wrote:
>
> Hello,
>
> I 'm quite impressed by the amount of work done for elm-mdl so I've 
> started using it instead of bootstrap. The Layout component is a bit 
> unfamiliar to me. How does it work exactly ? Are you supposed to have only 
> one for your entire elm app ?
>
> I'm also wondering about the Mdl.model ( in "part" mode). Is it ok to have 
> one in each of my components or should you pass it as props to the subviews 
> ? 
>
> My goal is to display scrollable tabs like on the elm-mdl demo site. At 
> the moment I have a tabs component that uses Mdl.Tabs. It works but the 
> display is messed up when there are too many tabs. That's why I need to 
> wrap them into a layout container (I think). I have nothing against moving 
> the content of my tabs component into my top level component if it makes 
> more sense.
>
> Last question: Is it ok to use layout if my component is not a fullscreen 
> elm app but rather embedded in a div ?
>  
>

-- 
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.

Reply via email to