Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Created January 31, 2015 17:48
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheSeamau5/717dbf7d299b2774634d to your computer and use it in GitHub Desktop.
Save TheSeamau5/717dbf7d299b2774634d to your computer and use it in GitHub Desktop.
Wrapping CSS Layout in Elm
type alias Bounds = {
left : Float,
right : Float,
top : Float,
bottom : Float
}
bounds : Bounds
bounds = Bounds 0 0 0 0
type FlexDirection = Row | Column
type FlexAlignment = FlexStart |
Center |
FlexEnd |
Stretch |
SpaceBetween |
SpaceAround
type PositionType = Relative | Absolute
type alias Style = {
dimensions : {
width : Float,
height : Float
},
position : Bounds,
margin : Bounds,
padding : Bounds,
borderWidth : Bounds,
flexDirection : FlexDirection,
justifyContent : FlexAlignment,
alignItems : FlexAlignment,
alignSelf : FlexAlignment,
flex : Float,
positionType : PositionType
}
style : Style
style = {
dimensions = {
width = 100,
height = 100
},
position = bounds,
margin = bounds,
padding = bounds,
borderWidth = bounds,
flexDirection = Column,
justifyContent = SpaceAround,
alignItems = Stretch,
alignSelf = Stretch,
flex = 1,
positionType = Relative
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment