Skip to content

fix: make header responsive on small screens#102

Merged
SatyamPandey-07 merged 4 commits into
niharika-mente:mainfrom
zaibamachhaliya:fix/header-responsive-320px
Jun 20, 2026
Merged

fix: make header responsive on small screens#102
SatyamPandey-07 merged 4 commits into
niharika-mente:mainfrom
zaibamachhaliya:fix/header-responsive-320px

Conversation

@zaibamachhaliya

@zaibamachhaliya zaibamachhaliya commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes the header responsiveness issue on small screen devices.

Changes Made

  • Added responsive mobile navigation.
  • Implemented hamburger menu for screens below md breakpoint.
  • Fixed header overflow issue.
  • Removed horizontal scrolling caused by navigation items.
  • Improved navigation accessibility on mobile devices.

Tested On

  • 320px
  • 375px
  • 425px
  • 768px+

Fixes:#99

Summary by CodeRabbit

  • New Features

    • Added mobile navigation toggle with Menu/Close icons for improved mobile usability.
  • Improvements

    • Enhanced desktop navigation with animated active link underlines and improved styling.
    • Updated header appearance with sticky positioning and refined visual design.
    • Improved logo typography and sizing for better visual hierarchy.

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

@zaibamachhaliya is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

NavLinks is refactored from a hardcoded list into a data-driven component using a links array, useState for a mobile menu toggle, and Menu/X icons. Navbar receives updated Tailwind wrapper classes, a logo element change, and a null Suspense fallback. next.config.ts and tsconfig.json are reformatted to multiline style with no value changes.

Changes

NavLinks/Navbar Refactor

Layer / File(s) Summary
Data-driven NavLinks with mobile dropdown
components/NavLinks.tsx
Replaces static hardcoded links with a links array and links.map(...), adds useState for open toggle, renders desktop nav with pathname-based active underline styling, and adds a md:hidden toggle button with Menu/X icons plus a conditional mobile dropdown that closes on link click.
Navbar wrapper styling and Suspense fallback
components/Navbar.tsx
Updates header/nav Tailwind classes to sticky, bordered, translucent black; changes logo from <p> to <span text-lg>; changes Suspense fallback from an animated loading element to null.

Config Reformatting

Layer / File(s) Summary
next.config.ts and tsconfig.json reformatting
next.config.ts, tsconfig.json
Reformats remotePatterns, rewrites, and skipTrailingSlashRedirect in next.config.ts to multiline style; reformats lib, plugins, paths, and exclude in tsconfig.json to multiline arrays — all values unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • niharika-mente/DevEvent_Tracker#85: Modifies the same components/NavLinks.tsx and components/Navbar.tsx files, including NavLinks rendering behavior and the Navbar Suspense wrapper/fallback.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description includes a summary of changes, testing details, and issue reference, but does not follow the required template structure with Type of Change and How Has This Been Tested sections. Complete the description template by adding the Type of Change checkbox selection and How Has This Been Tested section with detailed testing instructions and browser information.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly describes the main change: making the header responsive on small screens, which aligns with the primary objective of adding mobile navigation and fixing responsiveness issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zaibamachhaliya

Copy link
Copy Markdown
Contributor Author

Hi @maintainer PR is ready. Please review it.
Thank you!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/NavLinks.tsx`:
- Around line 25-33: The Link components in the navigation lack aria-current
attributes to communicate active state to screen readers, and the menu toggle
button (around line 46) is missing aria-expanded and aria-controls attributes to
expose its expanded/collapsed state. Add aria-current="page" to the Link
component when pathname === link.href to mark the currently active link for
assistive technology. Additionally, add aria-expanded={open} (or appropriate
boolean state) and aria-controls to reference the menu element ID on the toggle
button to properly communicate the menu's open/closed state to screen readers.

In `@package.json`:
- Around line 14-22: Remove the `@next/swc-win32-x64-msvc` dependency from
package.json as Next.js manages native SWC binaries automatically, and manually
declaring them causes dependency conflicts. Additionally, update the
eslint-config-next version from 16.1.3 to align with the Next.js 15.1.0 version
being used (change it to a compatible 15.x.x version) to resolve the major
version incompatibility that will cause linting to break.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c770eac9-b7b4-4354-a3de-75d7dd44ae07

📥 Commits

Reviewing files that changed from the base of the PR and between 96ecc66 and d3d8ebe.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !package-lock.json
📒 Files selected for processing (5)
  • components/NavLinks.tsx
  • components/Navbar.tsx
  • next.config.ts
  • package.json
  • tsconfig.json

Comment thread components/NavLinks.tsx
Comment thread package.json Outdated
@TarunyaProgrammer

Copy link
Copy Markdown
Collaborator

@zaibamachhaliya, first resolve all the requested changes by bots!

@TarunyaProgrammer TarunyaProgrammer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for working on the responsive header. The mobile menu implementation and navbar cleanup look good overall, but I noticed a few issues that should be addressed before merging:

  • The new links array changes some existing routes:

    • Create Event/events/create (currently /create-event)
    • My Bookings/bookings (currently /my-bookings)

    These appear to be regressions and may lead to broken navigation.

  • The desktop navigation no longer includes aria-current on active links, and the mobile menu button is missing aria-expanded / aria-controls. This is a small accessibility regression from the current implementation.

  • package.json, next.config.ts, and tsconfig.json contain unrelated changes that don't seem necessary for a responsive-header fix. It would be better to either explain them in the PR or keep this PR focused on the navbar changes only.

Once these are addressed, the responsive navigation changes look good.

@zaibamachhaliya

Copy link
Copy Markdown
Contributor Author

Hi @TarunyaProgrammer,

I have addressed the requested changes:

  • Restored the original routes (/create-event and /my-bookings)
  • Added aria-current for active navigation links
  • Added aria-expanded and aria-controls to the mobile menu button for accessibility
  • Kept the PR focused on navbar responsiveness

Could you please review the updated changes?

Thank you!

@TarunyaProgrammer TarunyaProgrammer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The responsive navigation implementation looks good overall, and the accessibility improvements (aria-current, aria-expanded, aria-controls) are a nice addition. However, there is one blocking issue that needs to be addressed before this can be merged.

The PR downgrades next from 16.1.3 to ^15.1.0 and removes cacheComponents: true from next.config.ts. The project currently uses the 'use cache' directive in components/EventDetails.tsx, which requires cacheComponents and Next.js 16. As a result, npm run build fails with:

To use "use cache", please enable the feature flag `cacheComponents` in your Next.js config.

Additionally, the dependency versions become inconsistent after the downgrade (next@15.x alongside eslint-config-next@16.1.3 and @next/swc-win32-x64-msvc@16.1.3).

Please revert the Next.js downgrade and restore:

cacheComponents: true

in next.config.ts, while keeping the responsive navbar changes. Once the build passes again, this should be good to go.

@zaibamachhaliya

Copy link
Copy Markdown
Contributor Author

Hi @TarunyaProgrammer,

I have addressed all the requested changes:

  • Restored Next.js 16.1.3
  • Restored cacheComponents: true in next.config.ts
  • Removed the unnecessary SWC dependency
  • Reverted unrelated tsconfig.json changes
  • Kept the PR focused on the responsive navbar improvements

I have pushed the latest updates to the branch. Could you please review the PR again when you have a chance?

Thank you for your time and feedback!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/NavLinks.tsx (1)

47-79: ⚡ Quick win

Consider adding keyboard and click-outside handlers for better UX.

The mobile menu implementation works well, but could be enhanced with two common patterns:

  1. Escape key to close: Pressing Escape should close the menu for keyboard users
  2. Click outside to close: Clicking outside the menu should dismiss it

These are optional enhancements that improve accessibility and user experience.

💡 Example implementation
// Add useEffect for keyboard handling
useEffect(() => {
  if (!open) return;
  
  const handleEscape = (e: KeyboardEvent) => {
    if (e.key === 'Escape') setOpen(false);
  };
  
  document.addEventListener('keydown', handleEscape);
  return () => document.removeEventListener('keydown', handleEscape);
}, [open]);

// Add ref and click-outside handler
const menuRef = useRef<HTMLDivElement>(null);

useEffect(() => {
  if (!open) return;
  
  const handleClickOutside = (e: MouseEvent) => {
    if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
      setOpen(false);
    }
  };
  
  document.addEventListener('mousedown', handleClickOutside);
  return () => document.removeEventListener('mousedown', handleClickOutside);
}, [open]);

// Add ref to mobile menu div
<div
  ref={menuRef}
  id="mobile-menu"
  // ... rest of props
>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/NavLinks.tsx` around lines 47 - 79, Add keyboard and click-outside
event handlers to the NavLinks component to improve mobile menu accessibility.
First, create a useRef for the mobile menu div and attach it to the element with
id="mobile-menu". Then add a useEffect hook that listens for the Escape key when
the menu is open and calls setOpen(false) to close it, ensuring proper cleanup
of the event listener. Finally, add another useEffect hook that detects clicks
outside the menu element and closes the menu by calling setOpen(false) when a
user clicks outside the referenced menu area, also with proper event listener
cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/NavLinks.tsx`:
- Line 28: Remove the `onClick={() => setOpen(false)}` handler from the desktop
navigation links in the NavLinks component since the `open` state only controls
mobile menu visibility and the desktop menu is always visible at the `md`
breakpoint and above. Desktop links should not trigger mobile menu state
changes. Keep the onClick handler only on mobile menu elements where it is
actually needed to close the menu when a link is clicked.

---

Nitpick comments:
In `@components/NavLinks.tsx`:
- Around line 47-79: Add keyboard and click-outside event handlers to the
NavLinks component to improve mobile menu accessibility. First, create a useRef
for the mobile menu div and attach it to the element with id="mobile-menu". Then
add a useEffect hook that listens for the Escape key when the menu is open and
calls setOpen(false) to close it, ensuring proper cleanup of the event listener.
Finally, add another useEffect hook that detects clicks outside the menu element
and closes the menu by calling setOpen(false) when a user clicks outside the
referenced menu area, also with proper event listener cleanup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97a47488-be6b-4368-a715-75a2dfc39ebc

📥 Commits

Reviewing files that changed from the base of the PR and between d3d8ebe and 6d4709c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !package-lock.json
📒 Files selected for processing (2)
  • components/NavLinks.tsx
  • next.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • next.config.ts

Comment thread components/NavLinks.tsx
@SatyamPandey-07 SatyamPandey-07 merged commit d3734a4 into niharika-mente:main Jun 20, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Medium SSoC26 TO CONTRIBUTE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants