-
Notifications
You must be signed in to change notification settings - Fork 26
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
[UKIT-96] feat(table): add new component DataTable #1233
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/commercetools/ui-kit/izl5997c1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see this taking off. The decision of using/building upon the same API is nice to ease the adoption. Can you elaborate maybe - if you have - what an improved API in a dreamy-🦄-world would look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package is missing all the package related stuff (package.json, LICENSE, src folder, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good so far! 👌
561c1e2
to
c771d08
Compare
173c707
to
a1858f4
Compare
a1858f4
to
acc6135
Compare
acc6135
to
21491a4
Compare
21491a4
to
1bfdc8a
Compare
Renamed this component to This PR will finally be merged after this. See this comment. |
Summary
The new
DataTable
component.UKIT-96
Description
The new table uses CSS-grid, doesn't use virtualization, and tries to keep a similar API as the existing table component.
Check out the latest version and be sure to play around with all the available knobs and column options:
https://ui-kit-git-ja-new-table.commercetools.now.sh/?path=/story/components-table-new--datatable
Feature Checklist
items
andcolumns
definition arrays, andrenderItem
prop replacingitemRenderer
.<table>
markup under the hood.useRowSelection
hook. This can also be done by the consumer, like it is on the old table)Follow-up:
A heads up about this commit: 0099678
I've changed the API a little bit:
items
prop renamed torows
, to create less confusion regarding the difference with actual items (cells) of a table. Also, I think it pairs better with thecolumns
prop.renderItem
prop of the table back toitemRenderer
, and this becomes the default renderer for each item. The default is set to simply render whatever is the value of an item property (usually it's a string). See: https://github.com/commercetools/ui-kit/pull/1233/files#diff-aa4a4319c62f56d7a3a775b74edbcb06R94renderItem
prop to the column definitions. This is the renderer to be used for custom cases per-column, taking precedence over the defaultitemRenderer
. I find it's easier to have this on the column definition (among with others likeonClick
), instead of having to implement aswitch (case)
logic on theitemRenderer
prop. However, that is still possible which may actually help migrate things from the old table faster.I dediced for these changes because it makes rendering a table much easier:
columns
androws
🎉