summaryrefslogtreecommitdiff
path: root/ibb
diff options
context:
space:
mode:
Diffstat (limited to 'ibb')
-rw-r--r--ibb/Main.hs54
1 files changed, 51 insertions, 3 deletions
diff --git a/ibb/Main.hs b/ibb/Main.hs
index 12225d0..01258f3 100644
--- a/ibb/Main.hs
+++ b/ibb/Main.hs
@@ -3,9 +3,11 @@
module Main where
+import Data.Function ((&))
+import Data.Text (Text)
import Web.Scotty (ActionM, scotty, get, html)
import Text.Blaze.Html.Renderer.Text (renderHtml)
-import Text.Hamlet (shamlet)
+import Text.Hamlet (shamlet, hamlet)
import Text.Blaze.Html (Html)
import Text.Blaze (Markup)
import Data.Monoid (mconcat)
@@ -15,11 +17,57 @@ render = html . renderHtml
main :: IO ()
main = scotty 3000 $
- get "/" $ render influencerCards
+ get "/" $ render homepage
+
+data Person = Person
+ { _name :: Text
+ , _twitter :: Text
+ , _website :: Text
+ , _books :: [Book]
+ }
+
+data Book = Book
+ { _title :: Text
+ , _author :: Text
+ , _link :: Text
+ }
+
+
+allPeople =
+ [ Person { _name = "Joe Rogan"
+ , _twitter = "joerogan"
+ , _website = "joerogan.com"
+ , _books = [ Book {_title = "Food of the Gods"
+ , _author = "fixme"
+ , _link = "fixme"
+ }
+ , Book { _title = "The War of Art"
+ , _author ="fixme"
+ , _link ="fixme"
+ }
+ ]
+ }
+ ]
+
+displayPerson person = [shamlet|
+<h4>#{_name person}
+<ul>
+ $forall book <- (_books person)
+ <li>#{_title book}
+|]
+
+homepage = [shamlet|
+<!doctype html>
+<head>
+ <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
+<body>
+ $forall person <- allPeople
+ #{displayPerson person}
+|]
+
influencerCards :: Markup
influencerCards = [shamlet|
-<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<nav .navbar .navbar-light .bg-light>
<h3 .navbar-brand>IBB
<button .navbar-toggler type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">