elm-mdl/examples/Demo/Grid.elm

53 lines
1.1 KiB
Elm
Raw Normal View History

2016-03-14 10:00:58 +00:00
module Demo.Grid where
import Material.Grid exposing (..)
2016-03-21 05:02:39 +00:00
import Material.Style exposing (Style, css)
2016-03-14 10:00:58 +00:00
import Html exposing (..)
2016-03-21 05:02:39 +00:00
-- Cell styling
style : Int -> List Style
style h =
[ css "text-sizing" "border-box"
, css "background-color" "#BDBDBD"
, css "height" (toString h ++ "px")
, css "padding-left" "8px"
, css "padding-top" "4px"
, css "color" "white"
]
-- Cell variants
democell : Int -> List Style -> List Html -> Cell
democell k styling =
cell <| List.concat [style k, styling]
small : List Style -> List Html -> Cell
small = democell 50
std : List Style -> List Html -> Cell
std = democell 200
-- Grid
2016-03-14 10:00:58 +00:00
view : List Html
view =
[ [1..12]
2016-03-21 05:02:39 +00:00
|> List.map (\i -> small [size All 1] [text "1"])
2016-03-19 22:47:21 +00:00
|> grid []
2016-03-14 10:00:58 +00:00
, [1 .. 3]
2016-03-21 05:02:39 +00:00
|> List.map (\i -> std [size All 4] [text <| "4"])
2016-03-19 22:47:21 +00:00
|> grid []
2016-03-21 05:02:39 +00:00
, [ std [size All 6] [text "6"]
, std [size All 4] [text "4"]
, std [size All 2] [text "2"]
2016-03-19 22:47:21 +00:00
] |> grid []
2016-03-21 05:02:39 +00:00
, [ std [size All 6, size Tablet 8] [text "6 (8 tablet)"]
, std [size All 4, size Tablet 6] [text "4 (6 tablet)"]
, std [size All 2, size Phone 4] [text "2 (4 phone)"]
2016-03-19 22:47:21 +00:00
] |> grid []
2016-03-14 10:00:58 +00:00
]
2016-03-19 22:47:21 +00:00