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

feat(nav): Display secondary nav in mobile menu #84582

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

malwilley
Copy link
Member

Ref #84018

  • Adds the secondary nav menu to the mobile menu when you first tap the hamburger menu
  • In order to display the header title, adds activeGroup state to the navigation context (also need to add a prop to <SecondaryNavigation /> and update callsites
  • Adds layout to the nav context so components can render differently based on the current layout (mobile or sidebar)

Before:

CleanShot 2025-02-04 at 15 56 38

After:

CleanShot.2025-02-04.at.15.56.50.mp4

@malwilley malwilley requested review from a team as code owners February 5, 2025 00:00
@malwilley malwilley removed request for a team February 5, 2025 00:00
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 5, 2025
Comment on lines 44 to 55
const value = useMemo(
() => ({secondaryNavEl, setSecondaryNavEl}),
[secondaryNavEl, setSecondaryNavEl]
() => ({
secondaryNavEl,
setSecondaryNavEl,
layout: isMobile ? NavLayout.MOBILE : NavLayout.SIDEBAR,
isCollapsed,
setIsCollapsed,
activeGroup,
setActiveGroup,
}),
[secondaryNavEl, isMobile, isCollapsed, setIsCollapsed, activeGroup]
);
Copy link
Member

Choose a reason for hiding this comment

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

what is useMemo here doing

Copy link
Member Author

Choose a reason for hiding this comment

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

I always wrap context values in useMemo to prevent every consumer of the context from rerendering if this component does. Though since the context is near the top of the render tree it probably doesn't matter much

@malwilley malwilley merged commit 343bd10 into master Feb 5, 2025
44 checks passed
@malwilley malwilley deleted the malwilley/feat/nav-secondary-mobile branch February 5, 2025 17:40
andrewshie-sentry pushed a commit that referenced this pull request Feb 5, 2025
- Adds the secondary nav menu to the mobile menu when you first tap the
hamburger menu
- In order to display the header title, adds `activeGroup` state to the
navigation context (also need to add a prop to `<SecondaryNavigation />`
and update callsites
- Adds `layout` to the nav context so components can render differently
based on the current layout (mobile or sidebar)
Copy link

sentry-io bot commented Feb 7, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TestingLibraryElementError: Unable to find an accessible element with the role "link" and name "Stats" Object.?(index.spec.tsx) View Issue

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants