PPaste!

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Network.Wai.Middleware.RequestLogger (logStdoutDev)
import           Text.Blaze.Html.Renderer.Text (renderHtml)
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import qualified Web.Scotty as S

buildPage :: H.Html -> H.Html -> H.Html
buildPage header content = do
  H.docTypeHtml $ do
    H.head $ do
      H.meta H.! A.charset "utf-8"
      H.title "Black Tape | Progressive Indie Rock from Paris"
      H.link H.! A.rel "stylesheet" H.! A.href "css/style.css"
    H.body $ do
      header
      content

buildHeader :: H.Html
buildHeader = do
  H.header $ do
    H.nav H.! A.class_ "stickynav" $ do
      H.ul $ do
        -- Black Tape main link
        H.li H.! A.class_ "header-logo" $ do
          H.a H.! A.class_ "#" $ H.toHtml "Black Tape"
        -- Central links
        links
        -- Social links
        socialLinks
  where
    links = do
      H.li $ H.toHtml "alo"

    socialLinks = do
      H.li H.! A.class_ "header-icons" $ do
        mapM_ (\(icon, link) -> H.a H.! A.href link $ H.i H.! A.class_ icon $ H.toHtml "")
          [("fa fa-facebook", "#")]


main :: IO ()
main = S.scotty 3000 $ do
  S.middleware logStdoutDev
  S.get "/" $ do
    S.html . renderHtml $ do
      buildPage buildHeader $ H.h1 "Hello"