Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper element + elm ui #1

Open
koenusz opened this issue Jul 17, 2020 · 1 comment
Open

wrapper element + elm ui #1

koenusz opened this issue Jul 17, 2020 · 1 comment

Comments

@koenusz
Copy link

koenusz commented Jul 17, 2020

Hi I would like to thank you for an amazing library.

I would like to suggest two additional features. Or maybe it is exposing a little bit more of your internals to the user. First one is an additional element function that allows you to pass childelements. Something like:

el : List ( Html.Attribute msg ) -> List ( Html.Element msg )-> ( Msg -> msg ) -> Html msg
el customAttrs children msgWrapper =
    let
--      attrs : List (Html.Attribute msg)
        attrs =
            Internal.attrs
                |> List.map ( Attr.map (Msg >> msgWrapper) )
    in
    Html.div
        ( customAttrs ++ attrs )
        children 

The other feature I would like to suggest is to expose your attribute function. Something like :

atrrs: ( Msg -> msg ) -> List ( Html.Attribute msg )
attrs  msgWrapper =
            Internal.attrs
                |> List.map ( Attr.map (Msg >> msgWrapper) )

This would be especially useful for people using elm-ui that want to enable touch events to their elm-ui elements.

Thanks again for an amazing lib.

@dullbananas
Copy link
Owner

I think it will only be necessary to expose attrs. I will also add an option to stop propagation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants