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

[EuiCollapsibleNavBeta] Allow consumer to control the collapsed state #7979

Merged

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Aug 26, 2024

In this PR I've updated the EuiCollapsibleNavBeta component to allow consumers to control the collapsed state of the navigation with a isCollapsed prop.

If the prop is not set, the collapsed state is controlled by the component (same as before this PR). If it is set, it is the parent that controls the state.

This work required to be able to handle elastic/kibana#190354

@sebelga sebelga requested a review from a team as a code owner August 26, 2024 10:43
- rename a few things
- spy on `onCollapseToggle` callback instead of internal state setter
- remove `isCollapsedControlled` branching logic from callbacks and use a `useEffect` instead to update internal state based on prop
Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Let me know if you have questions about the changes I pushed up or if for some reason they won't work for Kibana!

@cee-chen cee-chen enabled auto-merge (squash) August 27, 2024 01:09
@cee-chen cee-chen merged commit 8fb38bb into elastic:main Aug 27, 2024
5 checks passed
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@sebelga sebelga deleted the collapsiblenavbeta/controlable-collapse-state branch August 28, 2024 09:41
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.

3 participants