-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(DataTable): add small toolbar #5479
feat(DataTable): add small toolbar #5479
Conversation
This change adds small variant of table toolbar, used with compact/short variant of table rows. There were styles implemented for that presumably as part of original `v10` work, but it was not used somehow. Fixes carbon-design-system#5420.
Deploy preview for carbon-elements ready! Built with commit 1b99c97 |
Deploy preview for carbon-components-react ready! Built with commit 1b99c97 https://deploy-preview-5479--carbon-components-react.netlify.com |
{children} | ||
</section> | ||
); | ||
const TableToolbar = ({ children, size, ...rest }) => { |
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.
size
seems to always be equal to normal
. Do we need to update anything in the storybook examples to get this to work properly?
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.
I'm unable to see any changes when changing the row size via the knob on the with toolbar
story
same ^ |
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.
just a heads up, snapshots will need to be updated for CI
/** | ||
* `normal` Change the row height of table | ||
*/ | ||
size: PropTypes.oneOf(['compact', 'short', 'normal', 'tall']), |
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.
Would we rather this prop just live on the toolbar instead of being something passed in from DataTable with getToolbarProps
?
Also, seems like the comment is related to row size changes potentially?
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.
As the matter of fact, <DataTable>
has size
prop already and thus I thought it's sensible to propagate that to the tool bar. Let us know if you still like letting user set the toolbar size in application code, or something else.
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.
@asudoh got it, makes sense!
/** | ||
* `normal` Change the row height of table | ||
*/ | ||
size: PropTypes.oneOf(['compact', 'short', 'normal', 'tall']), |
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.
Should we include all of these options if they aren't currently being used? 👀
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.
Actually all are used. <TableToolbar>
code translates compact
/short
table size to the small variant of tool bar, and normal
/tall
table size to the normal variant of tool bar.
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.
It seems like only compact
and short
are being used, correct? The other values would noop?
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.
In general, it seems like from the issue what we want to express is "display the small variant of toolbar if the table size is either compact or short"? Would it make sense for the size to then be either "small" or "normal" since that would refer to the height of the toolbar versus the size referring to the table? This logic could then come from the DataTable
for determining the size in getToolbarProps
if we want to use that
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.
Moved the size translation logic to getToolbarProps()
as it seems to have been suggested: fe23222
@tw15egan @laurenmrice You are right that I forgot to check in the change in story. My apologies. Fixed. @emyarod My apologies for the snapshot thing, too - Updated. |
@asudoh should we also update the stories for |
@tw15egan Great catch - My apologies again for missing that. Fixed. |
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.
LGTM 👍 ✅
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.
Reviewing for Lauren who is OOO today.
Looks like it's working correctly now 👍
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.
@emyarod I think application can set an alternate width via style override in such scenario. CC @carbon-design-system/design just in case we should enlarge the button width by default. Technically we can add ellipsis, but I don't think doing so provides a good UX. |
Thanks @laurenmrice for the guidance! Fixed. |
The I also have another question. Is this pr affecting just the regular toolbar or also the batch action toolbar? Because the batch action toolbar at short and compact have misaligned text. |
Good catch @laurenmrice! (Were FF-only issues) Fixed both. |
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.
looks good to me ! thank you 🙌🏻
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.
looks good to me
This change adds small variant of table toolbar, used with compact/short variant of table rows.
There were styles implemented for that presumably as part of original
v10
work, but it was not used somehow.Fixes #5420.
Changelog
New
Testing / Reviewing
Testing should make sure our data table is not broken.