module Data.Niagra.Properties.Font
(
font,
fontFamily,
fontWeight,
fontSize
)
where
import Data.Niagra.Monad
import Data.Niagra.DSL
import Data.Niagra.Value
import Data.Niagra.Builder
import Data.Niagra.Builder.Numbers
import Data.Monoid
font :: (Monad m) => Builder -> [Builder] -> NiagraT m ()
font size fam = declaration "font" $ build [size, commaSeparate fam]
fontFamily :: (Monad m) => [Builder] -> NiagraT m ()
fontFamily = declaration "font-family" . commaSeparate
fontWeight :: (Monad m) => Integer -> NiagraT m ()
fontWeight = declaration "font-weight" . decimal
fontSize :: (Monad m) => Builder -> NiagraT m ()
fontSize = declaration "font-size"
commaSeparate :: [Builder] -> Builder
commaSeparate = f mempty True
where
f a _ [] = a
f a True (x:xs) = f x False xs
f a False (x:xs) = f (a <> singleton ',' <> x) False xs