LaunchPadLab / lp-components

Our Components
http://lp-components.herokuapp.com
MIT License
5 stars 1 forks source link

Enable passage of props when using custom `rowComponent` with SortableTable/Table #589

Closed vanderhoop closed 1 year ago

vanderhoop commented 1 year ago

At the moment, the SortableTable and Table components allow the passage of a custom rowComponent. However, there's no ability to pass additional props to this component from parent/consuming components, as this is presumed to just need the data.

In my current project, we're building a rather involved table, and it requires the passage of event handlers to a rowComponent from a parent. At the moment, our workaround is to either a) create the component in a closure that has access to the event handler, or b) force us to manage the state in a grander fashion with either contexts or redux. Neither option is ideal, as we're only passing the handler down through one component, and it occurred to us that this is something that the lp-components package could introduce at a very low complexity cost.

Release Notes

Semver minor bump (new behavior without breaking existing contracts), adding rowComponentProps, that get passed to the row component.

Author Checklist

chawes13 commented 1 year ago

@vanderhoop Is onClick the only event handler that you have a use case for in your client project? Or are there other dynamic handlers/attributes that the tr requires?

vanderhoop commented 1 year ago

hey @chawes13, thanks for taking a look at this. We no longer need this functionality, as we introduced actual button elements into the cells that need them, which is better for accessibility than clickable trs that lack keyboard event listeners. As such, I'm going to close this, lest it do harm!