From 4673f3c954e9edb00e214de5b26aa94188597790 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 30 Jan 2019 17:44:19 -0800 Subject: Begin transition to templating --- ibb/Main.hs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'ibb/Main.hs') 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| +

#{_name person} +