From 471e22a4e2bf0d273f8e3c23703556324d680fea Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 17 Nov 2020 18:52:55 -0500 Subject: [PATCH] Start with nav expanded --- .../src/components/AppContainer/NavExpandableGroup.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx b/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx index 6e91ef8611..9122a97272 100644 --- a/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx +++ b/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx @@ -7,10 +7,12 @@ class NavExpandableGroup extends Component { constructor(props) { super(props); const { routes } = this.props; + this.state = { isExpanded: true }; // Extract a list of paths from the route params and store them for later. This creates // an array of url paths associated with any NavItem component rendered by this component. this.navItemPaths = routes.map(({ path }) => path); + this.handleExpand = this.handleExpand.bind(this); this.isActiveGroup = this.isActiveGroup.bind(this); this.isActivePath = this.isActivePath.bind(this); } @@ -24,8 +26,13 @@ class NavExpandableGroup extends Component { return Boolean(matchPath(history.location.pathname, { path })); } + handleExpand(e, isExpanded) { + this.setState({ isExpanded }); + } + render() { const { groupId, groupTitle, routes } = this.props; + const { isExpanded } = this.state; if (routes.length === 1) { const [{ path }] = routes; @@ -39,8 +46,10 @@ class NavExpandableGroup extends Component { return ( {routes.map(({ path, title }) => (