Commit 36a63e5a authored by zlu's avatar zlu 🤸🏿
Browse files

Add book display skeleton

parent 0e8a0264
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
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