diff options
Diffstat (limited to 'src/Page.purs')
-rw-r--r-- | src/Page.purs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Page.purs b/src/Page.purs index 76cdf8d..07372d2 100644 --- a/src/Page.purs +++ b/src/Page.purs @@ -1,5 +1,6 @@ module Page where +import Data.Array ((:), sortBy) import Data.Maybe (Maybe(..)) import Halogen as H import Halogen.HTML as HH @@ -9,12 +10,11 @@ import Prelude import Food (Aliment) import Food as Food import Format as Format - -type State = Unit +import Indicator as Indicator data Query a = NoOp a - -data Message = Toggled Boolean +type State = Unit +type Message = Unit component :: forall m . H.Component HH.HTML Query State Message m component = @@ -32,7 +32,7 @@ component = [ HH.h1 [] [ HH.text "Glycémie" ] , HH.ul [ HP.class_ $ HH.ClassName "aliments" ] - ([renderTitle] <> (map renderAliment Food.all)) + (renderTitle : (map renderAliment <<< sortBy (\a b -> compare a.name b.name) $ Food.all)) ] eval :: Query ~> H.ComponentDSL State Query Message m @@ -65,7 +65,7 @@ renderAliment aliment = [] [ HH.text aliment.name ] , HH.div - [ HP.class_ $ HH.ClassName "number" ] + [ HP.class_ $ HH.ClassName ("number " <> (show $ Indicator.fromGlycemicIndex aliment.glycemicIndex)) ] [ HH.text (show aliment.glycemicIndex) ] , HH.div [ HP.class_ $ HH.ClassName "number" ] |