aboutsummaryrefslogtreecommitdiff
path: root/front
diff options
context:
space:
mode:
Diffstat (limited to 'front')
-rw-r--r--front/.gitignore2
-rw-r--r--front/elm.json24
-rw-r--r--front/src/Main.elm64
3 files changed, 90 insertions, 0 deletions
diff --git a/front/.gitignore b/front/.gitignore
new file mode 100644
index 0000000..e453cba
--- /dev/null
+++ b/front/.gitignore
@@ -0,0 +1,2 @@
+elm-stuff
+index.html
diff --git a/front/elm.json b/front/elm.json
new file mode 100644
index 0000000..ce2a08d
--- /dev/null
+++ b/front/elm.json
@@ -0,0 +1,24 @@
+{
+ "type": "application",
+ "source-directories": [
+ "src"
+ ],
+ "elm-version": "0.19.1",
+ "dependencies": {
+ "direct": {
+ "elm/browser": "1.0.2",
+ "elm/core": "1.0.5",
+ "elm/html": "1.0.0"
+ },
+ "indirect": {
+ "elm/json": "1.1.3",
+ "elm/time": "1.0.0",
+ "elm/url": "1.0.0",
+ "elm/virtual-dom": "1.0.3"
+ }
+ },
+ "test-dependencies": {
+ "direct": {},
+ "indirect": {}
+ }
+}
diff --git a/front/src/Main.elm b/front/src/Main.elm
new file mode 100644
index 0000000..fdf2fc4
--- /dev/null
+++ b/front/src/Main.elm
@@ -0,0 +1,64 @@
+module Main exposing (..)
+
+-- Press buttons to increment and decrement a counter.
+--
+-- Read how it works:
+-- https://guide.elm-lang.org/architecture/buttons.html
+--
+
+
+import Browser
+import Html exposing (Html, button, div, text)
+import Html.Events exposing (onClick)
+
+
+
+-- MAIN
+
+
+main =
+ Browser.sandbox { init = init, update = update, view = view }
+
+
+
+-- MODEL
+
+
+type alias Model = Int
+
+
+init : Model
+init =
+ 0
+
+
+
+-- UPDATE
+
+
+type Msg
+ = Increment
+ | Decrement
+
+
+update : Msg -> Model -> Model
+update msg model =
+ case msg of
+ Increment ->
+ model + 1
+
+ Decrement ->
+ model - 1
+
+
+
+-- VIEW
+
+
+view : Model -> Html Msg
+view model =
+ div []
+ [ button [ onClick Decrement ] [ text "-" ]
+ , div [] [ text (String.fromInt model) ]
+ , button [ onClick Increment ] [ text "+" ]
+ ]