-
-
Notifications
You must be signed in to change notification settings - Fork 425
fix: adjust navbar breakpoints to lg to prevent overflow #3272 #3324
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
base: main
Are you sure you want to change the base?
fix: adjust navbar breakpoints to lg to prevent overflow #3272 #3324
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughHeader breakpoint moved from 768px to 1024px: Header component and shared constant now use the larger desktop breakpoint; unit test mock updated accordingly to reflect the new threshold. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @frontend/src/components/Header.tsx:
- Line 61: The breakpoint constant desktopViewMinWidth is still 768 causing JS
to mismatch the CSS lg breakpoint; update desktopViewMinWidth from 768 to 1024
in frontend/src/utils/constants.ts, ensure the useIsMobile hook (which reads
desktopViewMinWidth) will now treat widths <1024 as mobile, and adjust the
Header.tsx handleResize logic (and any checks referencing desktopViewMinWidth or
directly using 768 in Header.tsx) so the mobile menu closes at >=1024; also
update the unit test mock in frontend/__tests__/unit/pages/Header.test.tsx to
use 1024 instead of 768 so tests reflect the new breakpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/__tests__/unit/pages/Header.test.tsx (1)
107-130: LGTM! Mock value correctly synchronized with the updated constant.The mock value
desktopViewMinWidth: 1024matches the actual constant inconstants.ts.Consider importing the actual constant instead of hardcoding the value in the mock. This would prevent the values from drifting out of sync in future updates:
♻️ Suggested improvement
+import { desktopViewMinWidth, headerLinks } from 'utils/constants' + // Mock constants -jest.mock('utils/constants', () => ({ - desktopViewMinWidth: 1024, - headerLinks: [ +jest.mock('utils/constants', () => { + const actual = jest.requireActual('utils/constants') + return { + ...actual, // Override only if needed for specific test scenarios - ... - ], -})) + } +})Alternatively, if the full mock is intentional for test isolation, the current approach is acceptable.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/__tests__/unit/pages/Header.test.tsxfrontend/src/utils/constants.ts
🔇 Additional comments (2)
frontend/__tests__/unit/pages/Header.test.tsx (1)
191-207: Consistent test setup with the new breakpoint.The
globalThis.innerWidthvalue of 1024 on line 198 correctly aligns with the updateddesktopViewMinWidthconstant, ensuring tests run at the desktop view threshold.frontend/src/utils/constants.ts (1)
125-125: Breakpoint constant correctly aligned with Tailwind'slgbreakpoint.The change to 1024 consistently applies across the codebase:
- JS constant matches Tailwind's
lgbreakpoint- CSS classes properly updated (
lg:block,lg:table-cell, etc.)- Test mocks synchronized to 1024
- All usages (Header resize handler, useIsMobile hook) operate correctly with the new value
|
Thank you for the suggestion! I've synchronized the hardcoded values to 1024 across the constants and tests to ensure consistency, but I’m choosing to keep the code simple and consistent with how the rest of the project is written. |
kasya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshita8120 hi! Thanks for working on this! Left a question/request.
Also, please resolve CodeRabbit comment.
Also please run make check-test and address found issues before pushing to remote - you haven't done that this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works good overall 👍🏼
One thing I noticed is that when we are at a 1024 and collaps some of the menus - the button are now still showing in the Header until 768 breakpoint. However, we also have them in the menu on the side. This causes Star and Sponsor buttons to show up in both places.
Do you think you can update that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sure, I'll shortly update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@frontend/__tests__/unit/pages/Header.test.tsx`:
- Around line 106-126: Remove the duplicate "// Mock constants" comment and
replace the vague "// Matches your logic" with a clearer note describing the
breakpoint; update the jest.mock block that overrides utils/constants (the
desktopViewMinWidth and headerLinks mock) to have a single "// Mock constants"
header and change the desktopViewMinWidth inline comment to something like "//
Updated breakpoint threshold for lg screens" so the purpose is explicit.
|



Resolves #3272 - Fix navbar items overflow on medium screens
This PR addresses the issue where navbar items would overlap or become inaccessible on medium-sized screens (768px - 1024px). Earlier in the specified screen size range (768px - 1024px), the sign in and theme change buttons were inaccessible due to overflow of the items in the navbar.
Changes Made:
Updated the responsive breakpoints in "Header.tsx" from md to lg.
Screenshots for different screen sizes after the changes were made:
Checklist
make check-testlocally: all warnings addressed, tests passed