50 lines
1.4 KiB
Haskell
50 lines
1.4 KiB
Haskell
module Fragments.Base where
|
|
|
|
import Data.Text
|
|
import Data.String (fromString)
|
|
import Lucid
|
|
|
|
baseContact :: Html () -> Html ()
|
|
baseContact content = div_ [class_ "main"] content
|
|
|
|
baseDoc :: String -> Html () -> Html ()
|
|
baseDoc title bodyContent = doctypehtml_ $ do
|
|
head_ $ do
|
|
meta_ [ name_ "viewport", content_ "width=device-width, initial-scale=1.0" ]
|
|
title_ $ fromString title
|
|
link_ [rel_ "stylesheet", type_ "text/css", href_ "/style.css"]
|
|
body_ bodyContent
|
|
|
|
baseFeed :: Html ()
|
|
baseFeed = div_ [class_ "main"] $ do
|
|
h2_ "Oops, I haven't been implemented yet."
|
|
h3_ "Check back in a couple days!"
|
|
|
|
baseHome :: Html () -> Html ()
|
|
baseHome content = div_ [class_ "main"] content
|
|
|
|
baseNav :: Html ()
|
|
baseNav = div_ [class_ "navContainer"] $ do
|
|
ul_ [class_ "mainNav"] $ do
|
|
li_ $ a_ [href_ "/"] "Home"
|
|
li_ $ a_ [href_ "/posts"] "Posts"
|
|
li_ $ a_ [href_ "/contact"] "Contact"
|
|
li_ $ a_ [href_ "/feed"] "Feed"
|
|
|
|
basePage :: String -> Html () -> Html()
|
|
basePage title body = baseDoc title $ baseNav <> body
|
|
|
|
basePost :: Html () -> Html ()
|
|
basePost content = div_ [class_ "main"] content
|
|
|
|
postIndex :: [FilePath] -> Html ()
|
|
postIndex postNames = div_ [class_ "main"] $ do
|
|
h1_ [class_ "title"] "All Posts"
|
|
ul_ [class_ "postList"] $ do
|
|
mapM_
|
|
(\x -> li_ $ a_ [href_ (pack $ "/posts/" ++ x)] (fromString x))
|
|
postNames
|
|
|
|
none :: Text
|
|
none = mempty
|