Verified Commit 4129e737 authored by zlu's avatar zlu 🤸🏿
Browse files

Remove unused files

parent 4a3360ee
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
main =
App.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
type alias Book =
{ title: String
, author: String
}
init : (Book, Cmd Msg)
init =
(Book "title" "author", Cmd.none)
type Msg = MorePlease
update : Msg -> Book -> (Book, Cmd Msg)
update msg book =
case msg of
MorePlease ->
(book, Cmd.none)
view : Book -> Html Msg
view book =
div []
[ h2 [] [ text book.title ]
, h2 [] [ text book.author ]
, button [ onClick MorePlease ] [ text "More" ]
]
subscriptions : Book -> Sub Msg
subscriptions book =
Sub.none
import Html exposing (..)
import Html.Events exposing (onClick)
import Html.App as App
import Random
import Array
main =
App.program
{ init = init,
view = view,
update = update,
subscriptions = subscriptions
}
type alias Model = { dieFace : Int }
type Msg = Roll | NewFace Int
init : (Model, Cmd Msg)
init =
(Model 1, Cmd.none)
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
Roll ->
(model, Random.generate NewFace (Random.int 0 (Array.length choices)))
NewFace newFace ->
(Model newFace, Cmd.none)
view : Model -> Html Msg
view model =
div []
[ h1 [] [ Html.text (Maybe.withDefault "Cannot decide, roll again" (Array.get model.dieFace choices)) ]
, button [ onClick Roll ] [ Html.text "Roll" ]
]
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
choices = Array.fromList [
"Ceara",
"Burger Bros",
"Boamesa",
"Vila Lobos",
"Manai",
"Itoshii Sushi",
"Graveyard Hotdogs" ]
This diff is collapsed.
import Html exposing (..)
import Html.Events exposing (onClick)
import Html.App as App
import Random
import Array
main =
App.program
{ init = init,
view = view,
update = update,
subscriptions = subscriptions
}
type alias Model = { dieFace : Int }
type Msg = Roll | NewFace Int
init : (Model, Cmd Msg)
init =
(Model 1, Cmd.none)
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
Roll ->
(model, Random.generate NewFace (Random.int 0 (Array.length choices)))
NewFace newFace ->
(Model newFace, Cmd.none)
view : Model -> Html Msg
view model =
div []
[ h1 [] [ Html.text (Maybe.withDefault "Cannot decide, roll again" (Array.get model.dieFace choices)) ]
, button [ onClick Roll ] [ Html.text "Roll" ]
]
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
choices = Array.fromList [
"Ceara",
"Burger Bros",
"Boamesa",
"Vila Lobos",
"Graveyard Hotdogs",
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment