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
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Network.Wai.Middleware.RequestLogger (logStdoutDev)
import           Stitch (CSS, renderCSS, (?), (.=))
import           Stitch.Combinators (cssImport, comment)
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

lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mattis vestibulum nisl in viverra. Proin luctus scelerisque eros, ut scelerisque elit pellentesque et. Phasellus pellentesque sit amet sapien et tincidunt. Sed tortor purus, vestibulum sed luctus at, rhoncus ut leo. Mauris quis mauris eget eros egestas accumsan. Morbi mattis ullamcorper ultrices. Praesent in nulla efficitur, lobortis ante quis, viverra mauris. Nam et semper turpis. Nunc hendrerit luctus justo non congue. Sed rhoncus, leo tempor pulvinar scelerisque, lorem nunc venenatis orci, et elementum justo enim non urna. Curabitur vestibulum auctor accumsan. Curabitur quis enim quis lectus faucibus auctor sit amet eget nunc. Sed aliquam massa ut neque accumsan, vitae facilisis felis varius. Mauris efficitur quam mauris, hendrerit aliquam orci dignissim eu. Morbi tempor luctus orci, nec aliquet arcu mattis eget. "

genericCSS :: CSS
genericCSS = do
  "*" ? do
    "font-family" .= "'Open Sans', sans-serif"

stickyNavCSS :: CSS
stickyNavCSS = do
  ".stickynav" ? do
    "width" .= "100%"
    "height" .= "40px"
    "position" .= "fixed"
    "top" .= "0"
    "border-top" .= "solid 5px black"
    "border-bottom" .= "solid 2px black"
    "background" .= "rgba(255, 0, 0, 1)"
    "z-index" .= "30"

    "ul" ? do
      "padding" .= "10px"
      "margin" .= "0 auto"
      "list-style" .= "none"
      "text-align" .= "center"

      "li" ? do
        "display" .= "inline-block"
        "margin" .= "0 10px"

        "a" ? do
          "padding" .= "10px 0"
          "font-size" .= "1rem"
          "text-decoration" .= "none"
          "transition" .= "all 0.2s ease"

        "a:hover" ? "color" .= "#34495E"

    ".header-logo" ? do
      "position" .= "fixed"
      "left" .= "0"
      "font-weight" .= "bold"

    ".header-icons" ? do
      "position" .= "fixed"
      "right" .= "0"

mainCSS :: CSS
mainCSS = "main" ? "margin-top" .= "60px"

marthaCSS :: CSS
marthaCSS = do
  cssImport "https://raw.githubusercontent.com/zachacole/Simple-Grid/master/simple-grid.css"
  cssImport "https://fonts.googleapis.com/css?family=Open+Sans"
  cssImport "https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"

  genericCSS
  stickyNavCSS
  mainCSS

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.style $ H.toHtml $ renderCSS marthaCSS -- TODO compressed
    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_ "#" $ "Black Tape"
        -- Central links
        links
        -- Social links
        socialLinks
  where
    links =
      mapM_ (\(name, link) -> H.li $ H.a H.! A.href link $ name)
      [ ("News", "#")
      , ("Music", "#")
      , ("Gallery", "#")
      , ("Shop", "#")
      , ("About", "#")
      , ("Contact", "#")
      , ("French", "#")
      ]

    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 $ "a")
          [ ("fa fa-facebook fa-fw", "#")
          , ("fa fa-twitter fa-fw", "#")
          , ("fa fa-instagram fa-fw", "#")
          , ("fa fa-youtube fa-fw", "#")
          , ("fa fa-music fa-fw", "#")
          , ("fa fa-spotify fa-fw", "#")
          ]

buildContent :: H.Html
buildContent = do
  H.main $ do
    H.div H.! A.class_ "container" $ do
      H.div H.! A.class_ "row" $ do
        H.div H.! A.class_ "col-6" $ do
          H.h1 "Concerts"
          H.p lorem
        H.div H.! A.class_ "col-6" $ do
          H.h1 "Members"
          H.p lorem

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