diff options
Diffstat (limited to 'src/Settlr/UI/Page.hs')
| -rw-r--r-- | src/Settlr/UI/Page.hs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Settlr/UI/Page.hs b/src/Settlr/UI/Page.hs new file mode 100644 index 0000000..a3cd497 --- /dev/null +++ b/src/Settlr/UI/Page.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE FlexibleContexts #-} + +module Settlr.UI.Page + ( page + ) where + +import Text.Blaze.Html5 (Html, (!), text, textValue) +import qualified Text.Blaze.Html5 as H +import qualified Text.Blaze.Html5.Attributes as A +import Data.Text (Text) +import Settlr.Config (Config(..)) +import Control.Monad.Reader (MonadReader, asks) + +page + :: MonadReader Config m + => Text -- ^ the page title + -> Html -- ^ main content + -> m Html -- ^ given the config, the rendered page (i.e., the entire html document) +page title content = do + cssPath <- asks cfgCssPath + pure $ H.docTypeHtml $ do + H.head $ do + H.meta ! A.charset "utf-8" + H.title (text (title <> " | Settlr")) + H.link ! A.rel "stylesheet" ! A.href (textValue cssPath) + H.body $ do + H.main $ do + content |
