Created
January 1, 2019 22:51
-
-
Save darkslategrey/094ea340564c29ab06b90de6e152c2ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module App exposing (Model, Msg(..), init, main, update, view) | |
-- import Todo.Commands | |
import Browser | |
import Cat | |
import Html exposing (Html, button, div, h1, h2, img, map, text) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (onClick) | |
-- exposing (Model(..), Msg(..), model, view) | |
---- MODEL ---- | |
type alias Model = | |
Int | |
init : ( Model, Cmd Msg ) | |
init = | |
( 0, Cmd.none ) | |
---- UPDATE ---- | |
type Msg | |
= NoOp | |
| Decrement | |
| CatMsg Cat.Msg | |
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
Decrement -> | |
-- Todo.Commands.fetchTodo(1) | |
( model + 1, Cmd.none ) | |
_ -> | |
( model, Cmd.none ) | |
-- ( model, Cmd.none ) | |
---- VIEW ---- | |
view : Model -> Html Msg | |
view model = | |
div [] | |
[ button [ onClick Decrement, class "bg-grey-light hover:bg-grey text-grey-darkest font-bold py-2 px-4 rounded" ] [ text "All campaigns" ] | |
, h1 [ class "text-5xl bg-green" ] [ text "Your Elm App is working! ye" ] | |
, h2 [] [ text (String.fromInt model) ] | |
, div [] | |
[ div [] [ Html.map CatMsg (Cat.view Cat.Failure) ] ] | |
] | |
---- PROGRAM ---- | |
main : Program () Model Msg | |
main = | |
Browser.element | |
{ view = view | |
, init = \_ -> init | |
, update = update | |
, subscriptions = always Sub.none | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment