aboutsummaryrefslogtreecommitdiff
path: root/src/Page.purs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Page.purs')
-rw-r--r--src/Page.purs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Page.purs b/src/Page.purs
new file mode 100644
index 0000000..83e4d73
--- /dev/null
+++ b/src/Page.purs
@@ -0,0 +1,45 @@
+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))
+ ]