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

Allow siblings of Tabs.Tab in Tabs component #131

Merged
merged 5 commits into from Sep 19, 2019
Merged

Conversation

vine77
Copy link
Contributor

@vine77 vine77 commented Sep 19, 2019

Right now, this enables creation of a Toolbar component in nebula-ui that uses Tabs under the hood.

Screen Shot 2019-09-19 at 12 00 04 PM

@vine77
Copy link
Contributor Author

vine77 commented Sep 19, 2019

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

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?

Copy link
Contributor Author

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

Copy link
Contributor

@nmuldavin nmuldavin 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 good here once tests pass

@vine77 vine77 merged commit 12a25b4 into master Sep 19, 2019
@vine77 vine77 deleted the allow-tab-siblings branch September 19, 2019 22:34
@vine77 vine77 restored the allow-tab-siblings branch September 19, 2019 22:34
@vine77 vine77 deleted the allow-tab-siblings branch September 19, 2019 22:34
melcherry98 pushed a commit that referenced this pull request Dec 19, 2019
vine77 pushed a commit that referenced this pull request Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants