Permalink
Browse files

Initialize current size in radio inputs

  • Loading branch information...
pietro909 committed Dec 13, 2016
1 parent 16020a2 commit 0b793a2c4d8450a96b4acd7a29be29d62da5ee70
Showing with 9 additions and 4 deletions.
  1. +9 −4 elm-in-action/PhotoGroove.elm
@@ -50,10 +50,15 @@ getPhotoUrl index =
Just photo -> photo.url
Nothing -> ""
viewSizeChooser : ThumbnailSize -> Html Msg
viewSizeChooser size =
viewSizeChooser : ThumbnailSize -> ThumbnailSize -> Html Msg
viewSizeChooser current size =
label []
[ input [ type_ "radio", name "size", onClick (SetSize size) ] []
[ input
[ type_ "radio"
, name "size"
, onClick (SetSize size)
, checked (size == current)
] []
, text (sizeToString size)
]
@@ -75,7 +80,7 @@ view model =
[ text "Surprise me!" ]
, h3 [] [ text "Thumbnail size:" ]
, div [ id "choose-size" ]
( List.map viewSizeChooser [ Small, Medium, Large ] )
( List.map (viewSizeChooser model.chosenSize) [ Small, Medium, Large ] )
, div [ id "thumbnails", class (sizeToString model.chosenSize) ]
(List.map (viewThumbnail model.selectedUrl) model.photos)
, img

0 comments on commit 0b793a2

Please sign in to comment.