summaryrefslogtreecommitdiff
path: root/src/Settlr/Views
diff options
context:
space:
mode:
Diffstat (limited to 'src/Settlr/Views')
-rw-r--r--src/Settlr/Views/ErrorNotFound.hs13
-rw-r--r--src/Settlr/Views/Home.hs12
2 files changed, 9 insertions, 16 deletions
diff --git a/src/Settlr/Views/ErrorNotFound.hs b/src/Settlr/Views/ErrorNotFound.hs
index d087c5e..b8c0712 100644
--- a/src/Settlr/Views/ErrorNotFound.hs
+++ b/src/Settlr/Views/ErrorNotFound.hs
@@ -5,6 +5,7 @@ module Settlr.Views.ErrorNotFound
) where
import Settlr.Config (ScriptM)
+import Settlr.UI.Page (page)
import Text.Blaze.Html5 (Html, (!), textValue)
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
@@ -14,11 +15,7 @@ import Network.CGI (setStatus)
viewErrorNotFound :: ScriptM Html
viewErrorNotFound = do setStatus 404 "Not Found"
homePath <- formatRoute RouteHome
- pure $ H.docTypeHtml $ do
- H.head $ do
- H.title "Not Found"
- H.meta ! A.charset "utf-8"
- H.body $ do
- H.h1 "Page Not Found"
- H.p "The requested page could not be found"
- H.a "Go back home" ! A.href (textValue homePath)
+ page "Not Found" $ do
+ H.h1 "Page Not Found"
+ H.p "The requested page could not be found"
+ H.a "Go back home" ! A.href (textValue homePath)
diff --git a/src/Settlr/Views/Home.hs b/src/Settlr/Views/Home.hs
index 14fedfd..eb4aea5 100644
--- a/src/Settlr/Views/Home.hs
+++ b/src/Settlr/Views/Home.hs
@@ -5,14 +5,10 @@ module Settlr.Views.Home
) where
import Settlr.Config (ScriptM)
-import Text.Blaze.Html5 (Html, (!))
+import Settlr.UI.Page (page)
+import Text.Blaze.Html5 (Html)
import qualified Text.Blaze.Html5 as H
-import qualified Text.Blaze.Html5.Attributes as A
viewHome :: ScriptM Html
-viewHome = pure $ H.docTypeHtml $ do
- H.head $ do
- H.title "Test"
- H.meta ! A.charset "utf-8"
- H.body $ do
- H.p "Hello, world!"
+viewHome = page "Home" $ do
+ H.p "Hello, world!"