diff options
author | Joris | 2017-04-05 17:04:33 +0200 |
---|---|---|
committer | Joris | 2017-04-05 17:04:33 +0200 |
commit | 9a95a674fbbf1e64d3ad07922d569c3a1c751cf2 (patch) | |
tree | 2f99889040b0af406df1c403b9d930fe77e706cf /src/Page.purs | |
parent | f6a73e5bd6a5e2d7d4eb9c8a14bdf1a0c8a4ac4c (diff) |
Show aliments, glycemic index, carbohydrates and glycemic charge
Diffstat (limited to 'src/Page.purs')
-rw-r--r-- | src/Page.purs | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/Page.purs b/src/Page.purs index 83e4d73..76cdf8d 100644 --- a/src/Page.purs +++ b/src/Page.purs @@ -1,12 +1,14 @@ module Page where -import Prelude import Data.Maybe (Maybe(..)) import Halogen as H import Halogen.HTML as HH +import Halogen.HTML.Properties as HP +import Prelude -import Aliment as Aliment -import Aliment (Aliment) +import Food (Aliment) +import Food as Food +import Format as Format type State = Unit @@ -27,19 +29,48 @@ component = render state = HH.div [] - [ HH.h1 [] [ HH.text "Sucre" ] + [ HH.h1 [] [ HH.text "Glycémie" ] , HH.ul - [] - (map renderAliment Aliment.all) + [ HP.class_ $ HH.ClassName "aliments" ] + ([renderTitle] <> (map renderAliment Food.all)) ] eval :: Query ~> H.ComponentDSL State Query Message m eval = case _ of NoOp next -> pure next +renderTitle :: H.ComponentHTML Query +renderTitle = + HH.li + [ HP.class_ $ HH.ClassName "title" ] + [ HH.div + [] + [ HH.text "Aliment" ] + , HH.div + [] + [ HH.text "Index glycémique" ] + , HH.div + [] + [ HH.text "Glucides pour 100 g" ] + , HH.div + [] + [ HH.text "Charge glycémique" ] + ] + renderAliment :: Aliment -> H.ComponentHTML Query renderAliment aliment = HH.li [] - [ HH.text (aliment.name <> ", index glycémique: " <> (show aliment.gi)) + [ HH.div + [] + [ HH.text aliment.name ] + , HH.div + [ HP.class_ $ HH.ClassName "number" ] + [ HH.text (show aliment.glycemicIndex) ] + , HH.div + [ HP.class_ $ HH.ClassName "number" ] + [ HH.text (show aliment.carbohydrates) ] + , HH.div + [ HP.class_ $ HH.ClassName "number" ] + [ HH.text (Format.number 2 <<< Food.glycemicLoad $ aliment) ] ] |