module Page where import Prelude import Data.Maybe (Maybe(..)) import Halogen as H import Halogen.HTML as HH import Aliment as Aliment import Aliment (Aliment) type State = Unit data Query a = NoOp a data Message = Toggled Boolean component :: forall m . H.Component HH.HTML Query State Message m component = H.component { initialState: const unit , render , eval , receiver: const Nothing } where render :: State -> H.ComponentHTML Query render state = HH.div [] [ HH.h1 [] [ HH.text "Sucre" ] , HH.ul [] (map renderAliment Aliment.all) ] eval :: Query ~> H.ComponentDSL State Query Message m eval = case _ of NoOp next -> pure next renderAliment :: Aliment -> H.ComponentHTML Query renderAliment aliment = HH.li [] [ HH.text (aliment.name <> ", index glycémique: " <> (show aliment.gi)) ]