2016-04-06 18:16:54 +00:00
|
|
|
module Demo.Page
|
|
|
|
( demo, package, mds, mdl
|
|
|
|
, fromMDL, fromMDS
|
2016-04-12 13:36:48 +00:00
|
|
|
, body1, body2
|
2016-04-06 18:16:54 +00:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
|
|
|
import Html exposing (..)
|
|
|
|
import Html.Attributes exposing (href, class)
|
|
|
|
import Markdown
|
|
|
|
|
|
|
|
import Material.Grid exposing (..)
|
|
|
|
import Material.Style as Style exposing (styled, cs, css, attribute)
|
|
|
|
import Material.Button as Button
|
|
|
|
import Material.Color as Color
|
|
|
|
import Material.Icon as Icon
|
|
|
|
|
|
|
|
|
|
|
|
-- REFERENCES
|
|
|
|
|
|
|
|
|
|
|
|
demo : String -> (String, String)
|
|
|
|
demo url =
|
|
|
|
( "Demo source", url )
|
|
|
|
|
|
|
|
|
|
|
|
package : String -> (String, String)
|
|
|
|
package url =
|
|
|
|
( "Package documentation", url )
|
|
|
|
|
|
|
|
|
|
|
|
mds : String -> (String, String)
|
|
|
|
mds url =
|
|
|
|
( "Material Design Specification", url )
|
|
|
|
|
|
|
|
|
|
|
|
mdl : String -> (String, String)
|
|
|
|
mdl url =
|
|
|
|
( "Material Design Lite documentation", url )
|
|
|
|
|
|
|
|
|
|
|
|
references : List (String, String) -> List Html
|
|
|
|
references links =
|
|
|
|
[ text "References"
|
|
|
|
, ul []
|
|
|
|
( links |> List.map (\(str, url) ->
|
|
|
|
li [] [ a [ href url ] [ text str ] ]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
-- DOCUMENTATION QUOTES
|
|
|
|
|
|
|
|
|
|
|
|
from : String -> String -> String -> Html
|
|
|
|
from title url body =
|
|
|
|
div []
|
|
|
|
[ text "From the "
|
|
|
|
, a [ href url ] [ text title ]
|
|
|
|
, text ":"
|
|
|
|
, Markdown.toHtml body
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
fromMDL : String -> String -> Html
|
|
|
|
fromMDL =
|
|
|
|
from "Material Design Lite documentation"
|
|
|
|
|
|
|
|
|
|
|
|
fromMDS : String -> String -> Html
|
|
|
|
fromMDS =
|
|
|
|
from "Material Design Specification"
|
|
|
|
|
|
|
|
|
|
|
|
-- TITLES
|
|
|
|
|
|
|
|
|
|
|
|
title : String -> Html
|
|
|
|
title t =
|
2016-04-08 13:51:45 +00:00
|
|
|
Style.styled Html.h1
|
2016-04-06 18:16:54 +00:00
|
|
|
[ Color.text Color.primary
|
2016-04-08 13:51:45 +00:00
|
|
|
--, cs "mdl-typography--display-4"
|
2016-04-06 18:16:54 +00:00
|
|
|
-- TODO. Typography module
|
|
|
|
]
|
2016-04-08 13:51:45 +00:00
|
|
|
[]
|
2016-04-06 18:16:54 +00:00
|
|
|
[ text t ]
|
|
|
|
|
|
|
|
|
|
|
|
demoTitle : Html
|
|
|
|
demoTitle =
|
2016-04-08 21:05:57 +00:00
|
|
|
Style.styled Html.h2
|
2016-04-06 18:16:54 +00:00
|
|
|
[ Color.text Color.primary
|
|
|
|
]
|
2016-04-08 21:05:57 +00:00
|
|
|
[]
|
|
|
|
[ text "Example" ]
|
2016-04-06 18:16:54 +00:00
|
|
|
|
|
|
|
-- VIEW SOURCE BUTTON
|
|
|
|
|
|
|
|
|
|
|
|
addr : Signal.Address Button.Action
|
|
|
|
addr = (Signal.mailbox Button.Click).address
|
|
|
|
|
|
|
|
|
|
|
|
fab : String -> Html
|
|
|
|
fab url =
|
|
|
|
Button.fab addr (Button.model False)
|
|
|
|
[ css "position" "fixed"
|
2016-04-08 21:05:57 +00:00
|
|
|
, css "right" "48px"
|
|
|
|
, css "top" "72px"
|
|
|
|
, css "z-index" "100"
|
2016-04-06 18:16:54 +00:00
|
|
|
, Button.colored
|
|
|
|
--, attribute (href srcUrl)
|
|
|
|
, attribute (Html.Attributes.attribute "onclick" ("alert('foo!');")) --("window.location.href = '" ++ srcUrl ++ "';") )
|
|
|
|
]
|
|
|
|
[ Icon.i "link" ]
|
|
|
|
|
|
|
|
|
|
|
|
-- BODY
|
|
|
|
|
|
|
|
|
2016-04-12 13:36:48 +00:00
|
|
|
body1 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
|
|
|
body1 t srcUrl contents links demo =
|
2016-04-06 18:16:54 +00:00
|
|
|
div []
|
2016-04-08 13:51:45 +00:00
|
|
|
[ title t
|
2016-04-08 21:05:57 +00:00
|
|
|
, grid [ noSpacing ]
|
2016-04-08 13:51:45 +00:00
|
|
|
[ cell [ size All 6, size Phone 4 ] [ contents ]
|
|
|
|
, cell
|
2016-04-08 21:05:57 +00:00
|
|
|
[ size All 5, offset Desktop 1, size Phone 4, align Top
|
|
|
|
, css "position" "relative"
|
|
|
|
]
|
2016-04-08 13:51:45 +00:00
|
|
|
( references <| ("Demo source", srcUrl) :: links )
|
|
|
|
]
|
2016-04-08 21:05:57 +00:00
|
|
|
--, fab srcUrl
|
|
|
|
-- TODO: buttons can't be links (yet)
|
|
|
|
-- TODO: FAB placement.
|
|
|
|
, demoTitle
|
2016-04-08 13:51:45 +00:00
|
|
|
, Style.div
|
2016-04-08 21:05:57 +00:00
|
|
|
[ css "margin-bottom" "48px"
|
|
|
|
--, css "margin-top" "48px"
|
|
|
|
-- , Elevation.shadow 2
|
|
|
|
]
|
|
|
|
demo
|
2016-04-08 13:51:45 +00:00
|
|
|
]
|
2016-04-06 18:16:54 +00:00
|
|
|
|
|
|
|
|
2016-04-12 13:36:48 +00:00
|
|
|
body2 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
|
|
|
body2 t srcUrl contents links demo =
|
|
|
|
div []
|
|
|
|
[ title t
|
|
|
|
, grid [ noSpacing ]
|
|
|
|
[ cell
|
|
|
|
[ size All 4, size Desktop 6 ]
|
|
|
|
[ div [] contents
|
|
|
|
, div
|
|
|
|
[]
|
|
|
|
( references <| ("Demo source", srcUrl) :: links )
|
|
|
|
]
|
|
|
|
, cell
|
|
|
|
[ size All 4, size Desktop 6 ]
|
|
|
|
( demoTitle
|
|
|
|
:: demo
|
|
|
|
)
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-06 18:16:54 +00:00
|
|
|
|
|
|
|
|