- html $ renderText $ html_ $ do
- head_ $ style >> title_ "Cool Blog"
- body_ $ do
- p_ $ a_ [href_ "/"] "Cool Blog"
- if authed
- then do
- a_ [href_ "/create"] "Create a Post"
- br_ []
- with form_ [action_ "/logout", method_ "post"] $
- input_ [type_ "submit", value_ "Log Out"]
- else with form_ [action_ "/login", method_ "post"] $ do
- input_ [name_ "username", placeholder_ "Username", type_ "text"]
- input_ [name_ "password", placeholder_ "Password", type_ "password"]
- input_ [type_ "submit"]
- sequence (mapMaybe render posts)