Orasund / elm-ui-widgets

Collection of reusable views for elm-ui.
https://orasund.github.io/elm-ui-widgets/
BSD 3-Clause "New" or "Revised" License
85 stars 11 forks source link

Add element columns to sort table #85

Closed lukasturcani closed 2 years ago

lukasturcani commented 2 years ago

Note

I have a question:

Should the element be automatically wrapped in an Element.el?

For example, this code

            , Widget.elementColumn
                { title = ""
                , value = \task ->
                        Widget.switch
                            (Material.switch Material.darkPalette)
                            { description = "active"
                            , onPress = Just <| ToggleActive task.index
                            , active = task.active
                            }

                , width = Element.fill
                }

leads to

image

I have to do


            , Widget.elementColumn
                { title = ""
                , value = \task ->
                    Element.el
                        []
                        (Widget.switch
                            (Material.switch Material.darkPalette)
                            { description = "active"
                            , onPress = Just <| ToggleActive task.index
                            , active = task.active
                            }
                        )
                , width = Element.fill
                }

to make it look right

image

I could edit the PR so that Element.el is used automatically, and the user does not have to write it, but I'm wondering if this can cause issues in other cases?

Description

Pull request solving issue #84.

Please only open Pull Requests for existing issues.

Checklist for new Widget

Optional:

Orasund commented 2 years ago

Currently, this would be a major change. I'd like it to instead be a minor one, so please instead of changing the type signature of a function, create a V2 version. So SortTableV2, ColumnV2, sortTableV2, floatColumnV2, intColumnV2, stringColumnV2 and unsortableColumnV2.

Regarding the wrapped El. Yes, you will have to wrap it in an Element.

lukasturcani commented 2 years ago

Ok updated:

Description

lukasturcani commented 2 years ago

Also updated docs.json