carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.82k stars 1.8k forks source link

[enhancement]: `UIShell/HeaderContainer` with multiple expandable panels #14630

Open lukas-kasticky opened 1 year ago

lukas-kasticky commented 1 year ago

Question for Carbon

Hi IBMer's,

UIShell/HeaderContainer has isSideNavExpanded and onClickSideNavExpand to control the sidenav/left-panel or the switcher/right-panel. The example containing both only implements the expand-logic of the side nav. How would I create a UI shell that uses two expandable panels? Am I supposed to implement my own version of HeaderContainer or is there a better way to go about this?

Thanks & have a nice day

Code of Conduct

lukas-kasticky commented 1 year ago

As far as I can tell, carbondesignsystem.com itself uses the community maintained gatsby-theme-carbon, which implements this multi-expandable-panel behaviour in the Layout.js component where LeftNav, Switcher and Header aren't wrapped in a HeaderContainer. They all use NavContext.js instead. Are there maybe less complicated examples I could look into before I start hacking away?

tw15egan commented 1 year ago

@lukas-kasticky I see what you mean, it seems like we need to add isRightPanel / onRightPanelClick props added to HeaderContainer. Example of the issue when trying to use isSideNavExpanded for both: https://stackblitz.com/edit/github-9gaz77?file=src%2FApp.jsx

lukas-kasticky commented 1 year ago

Exactly, or an array of isFooExpandeds and onClickFooExpands which would come in handy with https://github.com/carbon-design-system/carbon/issues/5152, where i mentioned this issue.