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

feat(DataTable): add small toolbar #5479

Merged
merged 15 commits into from
Mar 11, 2020

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Feb 28, 2020

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

  • Small variant of table toolbar, used with compact/short variant of table rows.

Testing / Reviewing

Testing should make sure our data table is not broken.

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.
@asudoh asudoh requested review from emyarod, tw15egan and a team February 28, 2020 08:36
@asudoh asudoh requested a review from a team as a code owner February 28, 2020 08:36
@asudoh asudoh requested review from laurenmrice and removed request for a team February 28, 2020 08:36
@netlify
Copy link

netlify bot commented Feb 28, 2020

Deploy preview for carbon-elements ready!

Built with commit 1b99c97

https://deploy-preview-5479--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 28, 2020

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 }) => {
Copy link
Member

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?

Copy link
Member

@tw15egan tw15egan left a 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

@laurenmrice
Copy link
Member

same ^

Copy link
Member

@emyarod emyarod left a 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']),
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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']),
Copy link
Contributor

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? 👀

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor Author

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

@asudoh
Copy link
Contributor Author

asudoh commented Mar 2, 2020

@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.

@tw15egan
Copy link
Member

tw15egan commented Mar 2, 2020

@asudoh should we also update the stories for with toolbar and possibly with dynamic content?

@asudoh
Copy link
Contributor Author

asudoh commented Mar 2, 2020

@tw15egan Great catch - My apologies again for missing that. Fixed.

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 ✅

Copy link
Member

@aagonzales aagonzales left a 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 👍

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should we do when the button content overflows? by default the button only has a min-height but since we are setting an explicit height on the compact toolbar and the toolbar button, we end up with this

image

@asudoh
Copy link
Contributor Author

asudoh commented Mar 6, 2020

@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.

@laurenmrice
Copy link
Member

We should allow the button to be able to change width based on the content inside of it. Like this for example:
Screen Shot 2020-03-06 at 9 18 01 AM

@asudoh
Copy link
Contributor Author

asudoh commented Mar 9, 2020

Thanks @laurenmrice for the guidance! Fixed.

@laurenmrice
Copy link
Member

laurenmrice commented Mar 9, 2020

The with toolbar story at the compact and short sizes have a primary button with text misaligned. It seem fine in the other stories though.

Screen Shot 2020-03-09 at 3 37 16 PM


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.

Screen Shot 2020-03-09 at 3 41 06 PM

@asudoh
Copy link
Contributor Author

asudoh commented Mar 10, 2020

Good catch @laurenmrice! (Were FF-only issues) Fixed both.

Copy link
Member

@laurenmrice laurenmrice left a 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 🙌🏻

Copy link
Member

@emyarod emyarod left a 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

@asudoh asudoh merged commit ef9c347 into carbon-design-system:master Mar 11, 2020
@asudoh asudoh deleted the small-table-toolbar branch March 11, 2020 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data table toolbar should be 32px height when table is short / compact
6 participants