initial commit

This commit is contained in:
2021-08-05 10:48:00 +02:00
commit da4d094689
16 changed files with 5453 additions and 0 deletions

36
client/elm/Loading.elm Normal file
View File

@@ -0,0 +1,36 @@
module Loading exposing (..)
import Html as H exposing (Html)
import Html.Attributes as HA
import Html.Events as HE
type alias Model =
Int
type Msg
= Dec
| Inc
init =
0
view mdl =
H.div []
[ H.button [ HE.onClick Dec ] [ H.text "-" ]
, H.button [ HE.onClick Inc ] [ H.text "+" ]
, H.text <| String.fromInt mdl
]
update : Msg -> Model -> Model
update msg mdl =
case msg of
Dec ->
mdl - 1
Inc ->
mdl + 1

39
client/elm/Main.elm Normal file
View File

@@ -0,0 +1,39 @@
module Main exposing (main)
import Browser as B
import Html as H exposing (Html)
import Html.Attributes as HA
import Html.Events as HE
import Loading
main =
B.sandbox { init = init, update = update, view = view }
type Model
= LoadingMdl Loading.Model
type Msg
= LoadingMsg Loading.Msg
init : Model
init =
LoadingMdl Loading.init
view : Model -> Html Msg
view mdl =
case mdl of
LoadingMdl m ->
H.map LoadingMsg <| Loading.view m
update : Msg -> Model -> Model
update msg_ mdl_ =
case ( msg_, mdl_ ) of
( LoadingMsg msg, LoadingMdl mdl ) ->
LoadingMdl <| Loading.update msg mdl