aboutsummaryrefslogtreecommitdiff
path: root/src/Page.purs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Page.purs')
-rw-r--r--src/Page.purs16
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) ]
]