diff options
author | Joris | 2017-04-04 23:40:54 +0200 |
---|---|---|
committer | Joris | 2017-04-04 23:42:42 +0200 |
commit | f6a73e5bd6a5e2d7d4eb9c8a14bdf1a0c8a4ac4c (patch) | |
tree | 184b0ef41ad60dcc9e5cc927604c031e0db81bbf /src/Page.purs | |
parent | 6228c242fda7b33bc919f2a74509314d1e671d4b (diff) |
Bootstrap purescript
Diffstat (limited to 'src/Page.purs')
-rw-r--r-- | src/Page.purs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Page.purs b/src/Page.purs new file mode 100644 index 0000000..83e4d73 --- /dev/null +++ b/src/Page.purs @@ -0,0 +1,45 @@ +module Page where + +import Prelude +import Data.Maybe (Maybe(..)) +import Halogen as H +import Halogen.HTML as HH + +import Aliment as Aliment +import Aliment (Aliment) + +type State = Unit + +data Query a = NoOp a + +data Message = Toggled Boolean + +component :: forall m . H.Component HH.HTML Query State Message m +component = + H.component + { initialState: const unit + , render + , eval + , receiver: const Nothing + } + where + render :: State -> H.ComponentHTML Query + render state = + HH.div + [] + [ HH.h1 [] [ HH.text "Sucre" ] + , HH.ul + [] + (map renderAliment Aliment.all) + ] + + eval :: Query ~> H.ComponentDSL State Query Message m + eval = case _ of + NoOp next -> pure next + +renderAliment :: Aliment -> H.ComponentHTML Query +renderAliment aliment = + HH.li + [] + [ HH.text (aliment.name <> ", index glycémique: " <> (show aliment.gi)) + ] |