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

update missing version in mobile #1522

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/gatsby-theme-aio/src/components/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ export default ({ children, pageContext, location }) => {
}, [setShowSearch]);

useEffect( () => {
setHasSideNav(false);
if (window.innerWidth >= parseInt(MOBILE_SCREEN_WIDTH)) {
setShowSideNav(false);
}
}, [location]);

useEffect(() => {
Expand Down Expand Up @@ -864,6 +866,7 @@ export default ({ children, pageContext, location }) => {
`}>
<SideNav
mainNavPages={pages}
versions={versions}
location={location}
selectedPages={sideNavSelectedPages}
selectedSubPages={sideNavSelectedSubPages}
Expand Down
4 changes: 3 additions & 1 deletion packages/gatsby-theme-aio/src/components/SideNav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getSelectedTabIndex = (location, pages) => {
return selectedIndex;
};

const SideNav = ({ mainNavPages, selectedPages, selectedSubPages, setShowSideNav, location }) => {
const SideNav = ({versions, mainNavPages, selectedPages, selectedSubPages, setShowSideNav, location }) => {
const [expandedPages, setExpandedPages] = useState([]);
const [expandedMenus, setExpandedMenus] = useState([]);
const [sideNavClick, setSideNavClick] = useState(false);
Expand Down Expand Up @@ -325,6 +325,7 @@ const SideNav = ({ mainNavPages, selectedPages, selectedSubPages, setShowSideNav
role="tree"
aria-label="Global Navigation"
className={classNames('spectrum-SideNav', 'spectrum-SideNav--multiLevel')}>
{versions && renderMenuTree([{title: 'Versions', menu: versions}], 1)}
{renderMenuTree(mainNavPages, 1)}
<AnchorButton variant="primary" href="/console" id={'consoleId'} tabIndex="0">
Console
Expand Down Expand Up @@ -357,6 +358,7 @@ const SideNav = ({ mainNavPages, selectedPages, selectedSubPages, setShowSideNav

SideNav.propTypes = {
mainNavPages: PropTypes.array,
versions: PropTypes.array,
selectedPages: PropTypes.array,
selectedSubPages: PropTypes.array,
setShowSideNav: PropTypes.func,
Expand Down