diff options
author | Ben Sima <ben@bsima.me> | 2021-03-17 21:26:44 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-03-17 21:26:44 -0400 |
commit | f061974833a4b6cf7582047bf31f239d0e621458 (patch) | |
tree | f8b9dcdfd053420259676b551116012134a4754e /Biz/App.hs | |
parent | 9dfdd80313442ee12864e72a46a86e165642d944 (diff) |
Add a HasCss class
This way I can attach page-specific CSS to the type for the page. I could make
this even tighter by combining HasCss with the HTML declaration, but that would
basically just be Lucid.ToHtml, so I'm not sure it is worth it.
Diffstat (limited to 'Biz/App.hs')
-rw-r--r-- | Biz/App.hs | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -6,12 +6,14 @@ -- | General utils for apps module Biz.App ( CSS (..), + HasCss (..), Manifest (..), - HtmlApp (..), + Html (..), ) where import Alpha +import qualified Clay import Data.Aeson (ToJSON) import qualified Data.Text.Lazy as Lazy import qualified Data.Text.Lazy.Encoding as Lazy @@ -50,5 +52,9 @@ instance ToJSON Manifest -- Ideally this would be captured in a Biz.App type, with overrides for head -- elements, and we would wouldn't have to make the same basic orphan instance -- for each app. -newtype HtmlApp a = HtmlApp a +newtype Html a = Html a deriving (Show, Eq) + +-- | Class for attaching some CSS to a page specifically. +class HasCss a where + cssFor :: a -> Clay.Css |