From f061974833a4b6cf7582047bf31f239d0e621458 Mon Sep 17 00:00:00 2001
From: Ben Sima <ben@bsima.me>
Date: Wed, 17 Mar 2021 21:26:44 -0400
Subject: 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.
---
 Biz/App.hs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'Biz/App.hs')

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
-- 
cgit v1.2.3