feat(elm): Add real button to task cards

This commit is contained in:
Vincent Ambo 2017-12-20 21:04:15 +01:00
parent ac623e4a7d
commit 7dbeb83f85

View file

@ -15,6 +15,8 @@ import Material.Grid exposing (grid, cell, size, Device(..))
import Material.Layout as Layout import Material.Layout as Layout
import Material.Scheme as Scheme import Material.Scheme as Scheme
import Material.Options as Options import Material.Options as Options
import Material.Elevation as Elevation
import Material.Button as Button
-- API interface to Gemma -- API interface to Gemma
@ -144,10 +146,12 @@ within task =
] ]
renderTask : Task -> Html Msg renderTask : Model -> Task -> Html Msg
renderTask task = renderTask model task =
Card.view Card.view
[ Color.background (Color.color (taskColor task) Color.S800) ] [ Color.background (Color.color (taskColor task) Color.S800)
, Elevation.e3
]
[ Card.title [] [ Card.head [ white ] [ text task.name ] ] [ Card.title [] [ Card.head [ white ] [ text task.name ] ]
, Card.text [ white ] , Card.text [ white ]
[ text (Maybe.withDefault "" task.description) [ text (Maybe.withDefault "" task.description)
@ -155,18 +159,20 @@ renderTask task =
, text (within task) , text (within task)
] ]
, Card.actions , Card.actions
[ Card.border [ Card.border ]
, white [ Button.render Mdl
, Options.onClick (Complete task) [ 0 ]
model.mdl
[ white, Button.ripple, Button.accent, Options.onClick (Complete task) ]
[ text "Completed" ]
] ]
[ text "Done!" ]
] ]
gemmaView : Model -> Html Msg gemmaView : Model -> Html Msg
gemmaView model = gemmaView model =
grid [] grid []
(List.map (\t -> cell [ size All 3 ] [ renderTask t ]) (List.map (\t -> cell [ size All 4 ] [ renderTask model t ])
model.tasks model.tasks
) )