Skip to content

Instantly share code, notes, and snippets.

@mdgriffith
Last active October 9, 2016 20:19
Show Gist options
  • Save mdgriffith/361719994fccff75323258053f2cc0f0 to your computer and use it in GitHub Desktop.
Save mdgriffith/361719994fccff75323258053f2cc0f0 to your computer and use it in GitHub Desktop.
import Style exposing (..)
import Style.Elements exposing (..)
baseText : Style.Text
baseText =
{ font = "georgia"
, size = 16
, characterOffset = Nothing
, lineHeight = 1.7
, italic = False
, boldness = Nothing
, align = alignLeft
, decoration = Nothing
, whitespace = normal
}
image : String -> List (Html.Attribute msg) -> List (Element msg) -> Element msg
image src attrs children =
elementAs "img"
empty
(Html.Attributes.src src :: attrs)
children
{-| -}
code : List (Html.Attribute msg) -> List (Element msg) -> Element msg
code =
elementAs "code"
{ empty
| text =
{ baseText | whitespace = pre }
}
link : List (Html.Attribute msg) -> List (Element msg) -> Element msg
link =
elementAs "a"
{ empty
| cursor = "pointer"
}
-------------------
-- Table Creation
-------------------
{-| -}
table : List (Html.Attribute msg) -> List (Element msg) -> Element msg
table =
elementAs "table"
{ empty
| layout = Style.tableLayout { spacing = all 0 }
}
{-| -}
tableHeader : List (Html.Attribute msg) -> List (Element msg) -> Element msg
tableHeader =
elementAs "th" empty
{-| -}
row : List (Html.Attribute msg) -> List (Element msg) -> Element msg
row =
elementAs "tr" empty
{-| -}
column : List (Html.Attribute msg) -> List (Element msg) -> Element msg
column =
elementAs "td" empty
--------------------
-- Input Elements
--------------------
{-| -}
button : List (Html.Attribute msg) -> List (Element msg) -> Element msg
button =
elementAs "button" empty
{-| -}
checkbox : List (Html.Attribute msg) -> List (Element msg) -> Element msg
checkbox attrs children =
elementAs "input"
empty
(Html.Attributes.type' "checkbox" :: attrs)
children
{-| -}
input : List (Html.Attribute msg) -> List (Element msg) -> Element msg
input =
elementAs "input" empty
{-| -}
textarea : List (Html.Attribute msg) -> List (Element msg) -> Element msg
textarea =
elementAs "textarea" empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment