-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(ui): Add new Collapsible component #22647
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
Conversation
| const {collapseButton} = this.props; | ||
|
|
||
| if (typeof collapseButton === 'function') { | ||
| return collapseButton({handleCollapse: this.onCollapseToggle}); |
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.
We should swap the prefixes here, the callback should be onCollapse and the method should be this.handleCollapseToggle.
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.
good catch, will do
| expect(wrapper.find('Button[data-test-id="expand"]').text()).toBe( | ||
| 'Show 2 collapsed items' | ||
| ); |
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.
imo we shouldn't use data-test-id for Buttons, we should instead use aria-label as that'll build good habits to ensure that our buttons are accessible.
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.
sure thing, let me switch to that
|
|
||
| return ( | ||
| <React.Fragment> | ||
| {itemsToRender.map(item => item)} |
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.
Do you need this map? There are no changes/extraction being done.
We are using this pattern already in multiple places and each has its own implementation.
In the follow-up PR, I will replace all of them with this reusable one.