daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest May 16th, 2018 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Screen exposing (..)
  2.  
  3. import Html exposing (Html, text)
  4. import Material
  5. import Material.Layout as Layout
  6. import Material.Badge as Badge
  7. import Material.Icon as Icon
  8. import Material.Options as Options exposing (cs, css, Property)
  9. import Material.Color as Color
  10. import Material.Button as Button
  11.  
  12.  
  13. --
  14.  
  15. import Update exposing (Msg(..), wrapScreen)
  16. import Model exposing (Model)
  17. import Router
  18.  
  19.  
  20. type alias Render =
  21.     Model -> List (Html Msg)
  22.  
  23.  
  24. defaultLayout : Model -> Render -> Html Msg
  25. defaultLayout model viewBody =
  26.     Layout.render Mdl
  27.         model.mdl
  28.         [ Layout.fixedHeader
  29.         ]
  30.         { header = [ viewHeader model ]
  31.         , drawer = [ model |> drawerElements |> viewDrawer ]
  32.         , tabs = ( viewTabs model, [ css "cursor" "pointer" ] )
  33.         , main = viewBody model
  34.         }
  35.  
  36.  
  37. viewHeader : Model -> Html Msg
  38. viewHeader model =
  39.     Layout.row
  40.         []
  41.         [ Layout.title []
  42.             [ text <| Router.header model.screen ]
  43.         , Layout.navigation []
  44.             []
  45.         ]
  46.  
  47.  
  48. viewTabs : Model -> List (Html msg)
  49. viewTabs model =
  50.     []
  51.  
  52.  
  53. viewDrawer : List (Html msg) -> Html msg
  54. viewDrawer elements =
  55.     Layout.navigation
  56.         []
  57.     <|
  58.         elements
  59.  
  60.  
  61. drawerElements : Render
  62. drawerElements model =
  63.     let
  64.         screenLink { screen } =
  65.             Layout.link
  66.                 [ Layout.href <| Router.url screen
  67.                 ]
  68.                 [ text <| Router.header screen
  69.                 ]
  70.     in
  71.         List.map screenLink Router.screens
  72.  
  73.  
  74. empty : Model -> List (Html msg)
  75. empty _ =
  76.     []
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top