module Data.CSS.Properties.Font
(
backgroundAttachment,
backgroundColor,
backgroundImage,
backgroundImageUrl,
backgroundPosition,
backgroundRepeat,
color,
fontFamily,
fontSize,
fontStyle,
fontVariant,
fontWeight,
textDecoration
)
where
import qualified Data.ByteString.Char8 as Bc
import Data.Colour
import Data.CSS.Properties.Types
import Data.CSS.Properties.Utils
import Data.CSS.Build
import Data.CSS.Types
import Data.Text (Text)
import Web.Routes.RouteT
backgroundAttachment :: BackgroundAttachment -> SetProp
backgroundAttachment = setProp "background-attachment"
backgroundColor :: (ColourOps f, ToPropValue (f a)) => f a -> SetProp
backgroundColor = setProp "background-color"
backgroundImage :: Maybe (CssUrl Text) -> SetProp
backgroundImage = setProp "background-image" . maybeProp "none"
backgroundImageUrl :: (MonadRoute m) => Maybe (URL m) -> SetPropM m
backgroundImageUrl img = do
renderUrl <- askRouteFn
backgroundImage . fmap (CssUrl . flip renderUrl []) $ img
backgroundPosition ::
(Real a, Real b)
=> FactorLen Length a
-> FactorLen Length b
-> SetProp
backgroundPosition = curry (setProp "background-position")
backgroundRepeat :: BackgroundRepeat -> SetProp
backgroundRepeat = setProp "background-repeat"
color :: (ColourOps f, ToPropValue (f a)) => f a -> SetProp
color = setProp "color"
fontFamily :: [FontFamily] -> SetProp
fontFamily =
setProp "font-family" .
PropValue .
Bc.intercalate "," .
map (_propValueStr . toPropValue)
fontSize :: (Real a) => FontSize a -> SetProp
fontSize = setProp "font-size"
fontStyle :: FontStyle -> SetProp
fontStyle = setProp "font-style"
fontVariant :: FontVariant -> SetProp
fontVariant = setProp "font-variant"
fontWeight :: FontWeight -> SetProp
fontWeight = setProp "font-weight"
textDecoration :: Maybe TextDecoration -> SetProp
textDecoration = setProp "text-decoration" . maybeProp "none"