{-# LANGUAGE OverloadedStrings #-}

module Style where

import           Control.Monad (void)
import           Clay
import           Clay.Selector (text)
import           Data.Monoid ((<>))
import           Data.Text (Text)
import qualified Data.Text.Lazy

groupColors :: [(Text, (Integer, Integer, Integer))] -> Css
groupColors ls = void $ sequence
  [ text ("[data-language=\"" <> lang <> "\"]") ? do
        background (rgb r g b)
  | (lang, (r, g, b)) <- ls
  ]

languages =
  [ ("trinako", (255, 200, 200))
  , ("verdash", (200, 255, 200))
  ]

style :: Data.Text.Lazy.Text
style = render $ do
  body ? do
    fontFamily ["Arial", "Helvetica"] [sansSerif]
    textAlign (alignSide (sideCenter))
    background (rgb 235 235 235)
  ".main" ? do
    width (px 500)
    marginLeft auto
    marginRight auto
  groupColors languages
  table ? border solid 1 black
  td ? padding (px 5) (px 5) (px 5) (px 5)
