Support for Lucid HTML, add static file middleware
This commit is contained in:
34
src/Views.hs
Normal file
34
src/Views.hs
Normal file
@@ -0,0 +1,34 @@
|
||||
module Views where
|
||||
|
||||
import Core
|
||||
|
||||
import Data.Text
|
||||
import Data.String (fromString)
|
||||
import Effectful
|
||||
import Lucid
|
||||
|
||||
baseDoc :: Html () -> Html ()
|
||||
baseDoc a = doctypehtml_ $ do
|
||||
head_ $ do
|
||||
meta_ [ name_ "viewport", content_ "width=device-width, initial-scale=1.0" ]
|
||||
title_ "HELPS Template!"
|
||||
link_ [rel_ "stylesheet", type_ "text/css", href_ "/style.css"]
|
||||
body_ $ do
|
||||
main_ [ class_ "container" ] a
|
||||
|
||||
root :: Html ()
|
||||
root = baseDoc $ do
|
||||
h1_ "Welcome to HELPS!"
|
||||
p_ "Haskell, Effectful, Lucid, PostgreSQL, Servant"
|
||||
p_ "You can get started by reviewing the README.md for directions on using \
|
||||
\ this template for your own projects."
|
||||
|
||||
userHtml :: User -> Html ()
|
||||
userHtml user = div_ [] $ do
|
||||
ul_ $ do
|
||||
li_ $ do
|
||||
"Username: " >> toHtml (show $ userName user)
|
||||
ul_ $ li_ $ "User ID: " >> toHtml (show $ userId user)
|
||||
|
||||
warning :: String -> Html ()
|
||||
warning s = p_ [class_ "warning"] (toHtml s)
|
||||
Reference in New Issue
Block a user