concept viewfilter in category elm
appears as: viewFilter

This is an excerpt from Manning's book Elm in Action.
viewLoaded photos selectedUrl chosenSize = [ h1 [] [ text "Photo Groove" ] , button [ onClick ClickedSurpriseMe ] [ text "Surprise Me!" ] , div [ class "filters" ] [ viewFilter "Hue" 0 , viewFilter "Ripple" 0 , viewFilter "Noise" 0 ]
Now that we have onSlide, we can use it in our viewFilter function. Remember how we made onSlide accept an Int -> msg function, so that we could pass it a different Msg variant on a case-by-case basis? We’ll want viewFilter to have that same flexibility. The only difference will be that because viewFilter returns an Html Msg, we won’t be using a type variable like msg; instead, viewFilter will accept an Int -> Msg function.
Listing 5.6. Using onImmediateValueChange in viewFilter
viewFilter : (Int -> Msg) -> String -> Int -> Html Msg viewFilter toMsg name magnitude = div [ class "filter-slider" ] [ label [] [ text name ] , rangeSlider [ Attr.max "11" , Attr.property "val" (Encode.int magnitude) , onSlide toMsg ] [] #1 , label [] [ text (String.fromInt magnitude) ] ]With this shiny new viewFilter implementation completed, our display logic is ready to be connected to our model and update. Once we’ve revised those to work with viewFilter, our shiny new custom elements will be fully integrated into our application!