If the compiler doesn’t, here goes:

type Msg pmsg
    = MouseUp
    | Click pmsg
buttonFab1 : pmsg -> String -> Html.Html (Msg pmsg)buttonFab1 action icon =
    Html.button [ onClick (Click action), onMouseUp MouseUp, class
"mdl-button mdl-button--fab mdl-button--colored" ]
        [ i [ class "material-icons" ] [ text icon ] ]

​

2016-05-28 20:56 GMT+02:00 Janis Voigtländer <[email protected]>:

> And changes to the type, but probably the compiler will help you with
> those.
>
> Am 28.05.2016 um 20:46 schrieb Zackie de Beer <[email protected]>:
>
> I am trying to create a button that you can pass a msg to it, the button
> will then call that message on click.
>
> This works nicely, when I click the button it wall send the message I
> passed in the action parameter.
>
> buttonFab : msg -> String -> Html.Html msg
> buttonFab action icon =
>     Html.button [ onClick action, class "mdl-button mdl-button--fab
> mdl-button--colored" ]
>         [ i [ class "material-icons" ] [ text icon ] ]
>
>
> But if I try to add control specific messages like the MouseUp message I
> run into trouble, I am not sure how I should pass it or map it in and out.
> This is what I tried but it gives an error.
>
>  type Msg msg
>     = MouseUp
>     | Click pmsg
>
> buttonFab1 : pmsg -> String -> Html.Html msg
> buttonFab1 action icon =
>     Html.button [ onClick Click action, onMouseUp MouseUp, class
> "mdl-button mdl-button--fab mdl-button--colored" ]
>         [ i [ class "material-icons" ] [ text icon ] ]
>
>
>
>
> --
> 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.
>
>

-- 
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