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
Allow siblings of Tabs.Tab in Tabs component #131
Conversation
Looks like I need to fix some tests. |
React.Children.toArray(children) | ||
.filter(child => child && child.props) | ||
.filter(child => child && child.props && child.type.displayName === 'Tab') |
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.
A while back we ran in to issues with hot-loading when depending directly on the existence of child.type
so we made this componentHasType
helper: https://github.com/puppetlabs/design-system/blob/master/packages/react-components/source/react/helpers/statics.js#L54
I think the underlying issue may have been resolved but you might want to use this helper anyways?
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 like the issue gaearon/react-hot-loader#1261 that warranted writing componentHasType()
is fixed as of react-hot-loader@4.10.0. I'm tempted to remove componentHasType entirely although I'm happy to keep it so folks don't have to think about what the right comparison is (in which case I'd remove component.type.prototype instanceof Type
and rely on component.type === Type
).
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 good here once tests pass
Right now, this enables creation of a Toolbar component in nebula-ui that uses Tabs under the hood.