{-# LANGUAGE OverloadedStrings #-} module Design.Helper ( clearFix , defaultButton , iconButton , defaultInput , centeredWithMargin , expandBlock , verticalCentering ) where import Prelude hiding (span) import Clay import Data.Monoid ((<>)) import Design.Constants import Design.Color as Color import qualified Clay.Display as D clearFix :: Css clearFix = after & do content (stringContent "") display D.table clear both defaultButton :: Color -> Color -> Size a -> (Color -> Color) -> Css defaultButton backgroundCol textCol h focusOp = do backgroundColor backgroundCol color textCol borderRadius radius radius radius radius verticalAlign middle cursor pointer lineHeight h height h textAlign (alignSide sideCenter) hover & backgroundColor (focusOp backgroundCol) focus & backgroundColor (focusOp backgroundCol) iconButton :: Color -> Color -> Size Abs -> (Color -> Color) -> Css iconButton backgroundCol textCol h focusOp = do defaultButton backgroundCol textCol h focusOp i <> span ? do height h lineHeight h span ? do display inlineBlock marginLeft (px 20) i ? do marginLeft (px 15) marginRight (px 20) defaultInput :: Integer -> Css defaultInput h = do height (px h) padding (px 10) (px 10) (px 10) (px 10) borderRadius radius radius radius radius border solid (px 1) Color.dustyGray focus & borderColor Color.silver verticalAlign middle centeredWithMargin :: Css centeredWithMargin = do width (pct blockPercentWidth) marginLeft auto marginRight auto expandBlock :: Color -> Color -> Size Abs -> Css expandBlock headerBackground headerColor headerHeight = do marginBottom blockMarginBottom marginLeft (pct blockPercentMargin) marginRight (pct blockPercentMargin) ".header" ? do defaultButton headerBackground headerColor headerHeight focusLighten width (pct 100) fontSize (px 18) borderRadius radius radius radius radius textAlign (alignSide sideLeft) position relative paddingLeft blockPadding paddingRight (px 55) verticalCentering :: Css verticalCentering = do position absolute top (pct 50) "transform" -: "translateY(-50%)"