From 69be67a67503c0cb80153510083513f92de952bf Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 9 Apr 2017 00:37:59 +0200 Subject: Add food --- src/Page.purs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Page.purs') 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) ] ] -- cgit v1.2.3