viewDeploy: (String, Bool) -> Html Msg
viewDeploy (deployment, isSelected) =
    li
      [ classList [("selected", isSelected)],  onClick (DeploySelected
deployment) ]
      [ text deployment ]

viewDeployments : List (String, Bool) -> Html Msg
viewDeployments deployments =
    ul [] ( List.map viewDeploy deployments )


This is one way to do it.


On Sat, Sep 17, 2016 at 12:14 PM, Roni Hacohen <[email protected]> wrote:

> Hello,
>
> I'm wondering what is the best solution for my problem,
>
> I have a List of deployments, once the user choses a deployment he will
> get more details about it,
> the view looks like this:
>
> viewDeploy: String -> Html Msg
> viewDeploy deployment =
>     li
>       [onClick (DeploySelected deployment)] [ text deployment ]
>
> viewDeployments : List String -> Html Msg
> viewDeployments deployments =
>     ul [] ( List.map viewDeploy deployments )
>
>
> Now, I want to add a classList to the li that will change its color,
> what is the best way to mark that deployment as selected?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to