Last active
March 24, 2016 21:03
-
-
Save rogeriochaves/d99444bc3873e385c05f 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
main = | |
ul [class "grocery-list"] | |
[ li [] [text "Pamplemousse"] | |
, li [] [text "Ananas"] | |
, li [] [text "Jus d'orange"] | |
, li [] [text "Boeuf"] | |
, li [] [text "Soupe du jour"] | |
, li [] [text "Camembert"] | |
, li [] [text "Jacques Cousteau"] | |
, li [] [text "Baguette"] | |
] | |
todoItem : Address Action -> Task -> Html | |
todoItem address todo = | |
li | |
[ classList [ ("completed", todo.completed), ("editing", todo.editing) ] ] | |
[ div | |
[ class "view" ] | |
[ input | |
[ class "toggle" | |
, type' "checkbox" | |
, checked todo.completed | |
, onClick address (Check todo.id (not todo.completed)) | |
] | |
[] | |
, label | |
[ onDoubleClick address (EditingTask todo.id True) ] | |
[ text todo.description ] | |
, button | |
[ class "destroy" | |
, onClick address (Delete todo.id) | |
] | |
[] | |
] | |
, input | |
[ class "edit" | |
, value todo.description | |
, name "title" | |
, id ("todo-" ++ toString todo.id) | |
, on "input" targetValue (Signal.message address << UpdateTask todo.id) | |
, onBlur address (EditingTask todo.id False) | |
, onEnter address (EditingTask todo.id False) | |
] | |
[] | |
] | |
taskEntry : Address Action -> String -> Html | |
taskEntry address task = | |
header | |
[ id "header" ] | |
[ h1 [] [ text "todos" ] | |
, input | |
[ id "new-todo" | |
, placeholder "What needs to be done?" | |
, autofocus True | |
, value task | |
, name "newTodo" | |
, on "input" targetValue (Signal.message address << UpdateField) | |
, onEnter address Add | |
] | |
[] | |
] | |
infoFooter : Html | |
infoFooter = | |
footer [ id "info" ] | |
[ p [] [ text "Double-click to edit a todo" ] | |
, p [] | |
[ text "Written by " | |
, a [ href "https://github.com/evancz" ] [ text "Evan Czaplicki" ] | |
] | |
, p [] | |
[ text "Part of " | |
, a [ href "http://todomvc.com" ] [ text "TodoMVC" ] | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment