Thomas Brisbout
Freelance JS developer
@tbrisbout
Elm Paris Meetup / 2016-09-20
import Html exposing (div)
import Css exposing (..)
viewStyles =
styles
[ ("height", "100%")
, ("margin", "0")
, ("text-align", "center")
, ("font-family", "Montserrat, Arial")
, ("background-color", "#ffggff")
]
view =
div [ viewStyles ] []
import Html exposing (div)
import Css exposing (..)
(=>) = (,)
viewStyles =
styles
[ "height" => "100%"
, "margin" => "0"
, "text-align" => "center"
, "font-family" => "Montserrat, Arial"
, "background-color" => "#ffggff"
]
view =
div [ viewStyles ] []
import Html exposing (div)
import Css exposing (..)
viewStyles =
styles
[ height (pc 100)
, margin (px 0)
, textAlign center
, fontFamilies [ "Montserrat", "Arial" ]
, backgroundColor (hex "#ffggff")
]
view =
div [ viewStyles ] []
Implementation of most CSS properties as functions and values as types
import Html exposing (style)
import Css exposing (..)
styles : List Css.Mixin -> Html.Attribute Msg
styles =
Css.asPairs >> styleloadStylesheet : String -> Html Msg
loadStylesheet url =
let
tag =
"link"
attrs =
[ attribute "rel" "stylesheet"
, attribute "property" "stylesheet"
, attribute "href" url
]
children =
[]
in
node tag attrs children
fontAwesome : Html Msg
fontAwesome =
loadStylesheet "https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"
bootstrap : Html Msg
bootstrap =
loadStylesheet "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
externalStylesheets : List (Html Msg)
externalStylesheets =
[ fontAwesome, bootstrap ]
source: coreytrampe/ExternalCSS.elm
css =
(stylesheet << namespace homepageNamespace.name)
[ header
[ backgroundColor (rgb 90 90 90)
, boxSizing borderBox
, padding (px -80)
]
, nav
[ display inlineBlock
, paddingBottom (px 12)
]
, (.) NavLink
, color (rgb 255 255 255)
]
, (#) ReactiveLogo
[ display inlineBlock
, marginLeft (px 150)
, verticalAlign middle
]
]port module Stylesheets exposing (..)
import Css.File exposing (..)
import MyCss
import Html exposing (div)
import Html.App as Html
port files : CssFileStructure -> Cmd msg
cssFiles : CssFileStructure
cssFiles =
toFileStructure
[ ( "styles.css", compile MyCss.css ) ]
main =
Html.program
{ init = ( (), files cssFiles )
, view = \_ -> (div [] [])
, update = \_ _ -> ( (), Cmd.none )
, subscriptions = \_ -> Sub.none
}module SharedStyles exposing (..)
import Html.CssHelpers exposing (withNamespace)
type CssClasses
= NavLink
type CssIds
= ReactiveLogo
| BuyTickets
homepageNamespace =
withNamespace "homepage"module ColorScheme exposing (..)
headerBg : Color
headerBg =
hex "#3ca0b8"
headerColor : Color
headerColor =
hex "#ffffff"
talkTitle : Color
talkTitle =
hex "#e33e57"
eventTitle : Color
eventTitle =
hex "#7fd13b"