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

EuiNavDrawerGroup is too strict about what can be passed in as children #2709

Closed
myasonik opened this issue Dec 20, 2019 · 0 comments · Fixed by #2710
Closed

EuiNavDrawerGroup is too strict about what can be passed in as children #2709

myasonik opened this issue Dec 20, 2019 · 0 comments · Fixed by #2710
Labels

Comments

@myasonik
Copy link
Contributor

myasonik commented Dec 20, 2019

This makes it difficult to conditionally render segments of the nav.

Two things which to better enable conditional rendering to be easier:

  • Allowing React.Fragment>
  • Allowing undefined

Made-up code example of what I'm trying to accomplish:

function conditionRender() {
	if (condition) return (<EuiNavDrawerGroup listItems={linksTwo} />);

	// All nested navs in here are broken 👇
	return (<>
		<EuiNavDrawerGroup listItems={linksTwo} />
		<EuiNavDrawerGroup listItems={linksThree} />
	</>);
}

const render = () => (
	<EuiNavDrawer>
		<EuiNavDrawerGroup listItems={linksOne} />
		{this.conditionalRender()}
	</EuiNavDrawer>);
);
@myasonik myasonik added the bug label Dec 20, 2019
@myasonik myasonik changed the title EuiNavDrawerGroup doesn't support nested navs if it's wrapped by a Fragment EuiNavDrawerGroup is too strict about what can be passed in as children Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant