summaryrefslogtreecommitdiff
path: root/Biz/App.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-03-17 21:26:44 -0400
committerBen Sima <ben@bsima.me>2021-03-17 21:26:44 -0400
commitf061974833a4b6cf7582047bf31f239d0e621458 (patch)
treef8b9dcdfd053420259676b551116012134a4754e /Biz/App.hs
parent9dfdd80313442ee12864e72a46a86e165642d944 (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.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Biz/App.hs b/Biz/App.hs
index 5e66f71..9c0b7a7 100644
--- a/Biz/App.hs
+++ b/Biz/App.hs
@@ -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