diff options
author | Joris | 2017-04-09 00:37:59 +0200 |
---|---|---|
committer | Joris | 2017-04-09 00:37:59 +0200 |
commit | 69be67a67503c0cb80153510083513f92de952bf (patch) | |
tree | 62de654cdcc1efeea25788f9e80d69b4f01a1fab /src/Page.purs | |
parent | ba548aafb4dcad5d7d69ef85b9b13e852facd31d (diff) |
Add food
Diffstat (limited to 'src/Page.purs')
-rw-r--r-- | src/Page.purs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Page.purs b/src/Page.purs index 07372d2..c0b641c 100644 --- a/src/Page.purs +++ b/src/Page.purs @@ -1,4 +1,7 @@ -module Page where +module Page + ( component + , Query + ) where import Data.Array ((:), sortBy) import Data.Maybe (Maybe(..)) @@ -32,7 +35,7 @@ component = [ HH.h1 [] [ HH.text "Glycémie" ] , HH.ul [ HP.class_ $ HH.ClassName "aliments" ] - (renderTitle : (map renderAliment <<< sortBy (\a b -> compare a.name b.name) $ Food.all)) + (renderTitle : (map renderAliment <<< sortBy (\a b -> Format.compare a.name b.name) $ Food.all)) ] eval :: Query ~> H.ComponentDSL State Query Message m @@ -65,12 +68,13 @@ renderAliment aliment = [] [ HH.text aliment.name ] , HH.div - [ HP.class_ $ HH.ClassName ("number " <> (show $ Indicator.fromGlycemicIndex aliment.glycemicIndex)) ] + [ 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) ] + , let glycemicLoad = Food.glycemicLoad aliment + in HH.div + [ HP.class_ $ HH.ClassName ("number " <> (show $ Indicator.fromGlycemicLoad glycemicLoad)) ] + [ HH.text (Format.number 2 glycemicLoad) ] ] |