Skip to content

Instantly share code, notes, and snippets.

@darkslategrey
Created January 1, 2019 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkslategrey/094ea340564c29ab06b90de6e152c2ec to your computer and use it in GitHub Desktop.
Save darkslategrey/094ea340564c29ab06b90de6e152c2ec to your computer and use it in GitHub Desktop.
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