Skip to content

enhance navbar#617

Open
Luffy-456 wants to merge 1 commit into
GitMetricsLab:mainfrom
Luffy-456:enhance-navbar
Open

enhance navbar#617
Luffy-456 wants to merge 1 commit into
GitMetricsLab:mainfrom
Luffy-456:enhance-navbar

Conversation

@Luffy-456
Copy link
Copy Markdown
Contributor

@Luffy-456 Luffy-456 commented May 30, 2026

Related Issue


Description

The current navbar is functional but lacks a modern and visually appealing design. The overall appearance feels basic and doesn't fully align with UI/UX standards used in modern web applications.

Changes Made:

  • Added animated sliding pill for desktop navigation hover states
  • Refactored nav links into a reusable navItems array
  • Added scroll detection for dynamic navbar glass effect
  • Applied backdrop blur and translucent background on scroll
  • Improved navbar visual polish in both light and dark modes
  • Fixed mobile theme toggle icon visibility
  • Added custom opening animation for mobile menu

How Has This Been Tested?

  • Verified navbar rendering in both light and dark modes
  • Tested hover animations for all desktop navigation items
  • Verified scroll-based blur and transparency effects
  • Tested mobile menu open/close behavior
  • Confirmed theme toggle functionality on desktop and mobile devices

Screenshots (if applicable)

2026-05-30.13-30-07.mp4

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

- Added animated sliding pill for desktop navigation hover states
- Refactored nav links into a reusable navItems array
- Added scroll detection for dynamic navbar glass effect
- Applied backdrop blur and translucent background on scroll
- Improved navbar visual polish in both light and dark modes
- Fixed mobile theme toggle icon visibility
- Added custom opening animation for mobile menu
@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 932da92
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1a9a3ebf43ff0007628ca6
😎 Deploy Preview https://deploy-preview-617--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

Navbar component refactored with a centralized navItems array, scroll-tracking nav styling, desktop sliding pill hover indicator with ref-based positioning, and mobile menu rebuilt from navItems with fade-in animation. CSS utilities added for the animation effect.

Changes

Navbar modernization with scroll tracking, sliding pill, and mobile menu improvements

Layer / File(s) Summary
Navbar foundation: state, hooks, and navigation data
src/components/Navbar.tsx
Imports updated; navItems array introduced; state hooks for isOpen, pillStyle, and scrolled added; scroll effect implemented to track position and update nav styling; ref-based hover measurement and pill hide/show handlers (onMouseEnter, onMouseLeave) configured; navLinkClass computed from active route.
Desktop navigation with sliding pill indicator
src/components/Navbar.tsx
Desktop nav refactored to map navItems and render NavLink components; sliding pill <span> added with position, size, and opacity driven by pillStyle; hardcoded NavLink elements and navLinkStyles removed.
Mobile menu with fade-in animation
src/components/Navbar.tsx, src/index.css
Mobile menu content replaced with navItems-driven NavLink list, each closing menu on click; mobile menu container includes ani-fade-in class; fade-in keyframes animation and .ani-fade-in utility class added with opacity, vertical translation, and blur effects.
Mobile theme toggle Moon icon styling
src/components/Navbar.tsx
Moon icon color class adjusted when mode is dark; toggleTheme callback and Sun/Moon conditional rendering unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

  • #353: This PR directly implements the modern navbar design transformation requested, introducing the sliding pill hover indicator, improved mobile menu with animation, scroll-based nav styling, and refined theme toggle presentation.
  • #261: Related navbar UI redesign focusing on active-item highlighting, spacing refinements, and theme toggle styling tweaks that align with this PR's modernization.
  • #201: The sliding pill hover effect, updated nav link styling classes, and fade-in animation utilities introduced in this PR directly implement the styling and hover-effect improvements outlined.

Possibly related PRs

  • GitMetricsLab/github_tracker#167: Modifies src/components/Navbar.tsx mobile navigation menu (theme-dependent styling and mobile link rendering), directly related to this PR's mobile menu refactor.
  • GitMetricsLab/github_tracker#237: Refactors src/components/Navbar.tsx desktop/mobile navigation rendering via navItems/NavLink and adjusts theme-toggle/menu UI, overlapping at the navbar code level.
  • GitMetricsLab/github_tracker#282: Modifies src/components/Navbar.tsx navigation link rendering/styling with hover-related logic that overlaps with this PR's refactored link styling.

Suggested labels

gssoc25, level:intermediate, quality:clean, type:feature, ui/ux

Poem

🐰 A navbar now gleams with modern flair,
Sliding pills dance on hover with care,
Mobile menus fade in so smooth and light,
Scroll-tracked styling sharpens the sight,
The garden of UI grows ever more bright! 🌸

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'enhance navbar' is vague and generic, using non-descriptive terms that don't convey specific information about the actual changes implemented. Replace with a more descriptive title such as 'Add modern navbar design with sliding pill animation and scroll detection' to better reflect the scope of changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully implements the requirements from issue #353 by modernizing the navbar design with a sliding pill animation, scroll detection, dynamic glass effect, improved styling for light/dark modes, and mobile enhancements.
Out of Scope Changes check ✅ Passed All changes in Navbar.tsx and index.css are directly aligned with modernizing the navbar design as specified in issue #353; no out-of-scope changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description includes all required sections from the template with comprehensive details about changes, testing, and type of change.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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

🧹 Nitpick comments (2)
src/index.css (2)

94-104: ⚡ Quick win

Prefer transform/opacity-only animation to avoid expensive blur repainting.

Animating filter: blur() here can introduce visible jank on low-end/mobile devices. Keep the effect to opacity + transform for smoother menu open.

Proposed change
 `@layer` utilities{
   `@keyframes` fade-in{
     from {
       opacity:0; 
       transform: translateY(20px); 
-      filter:blur(45px);
     }
     to{
       opacity:1;
       transform: translateY(0); 
-      filter:blur(0);
     }
   }
   .ani-fade-in{
     animation: fade-in 0.8s ease-out both;
   }
 }

Also applies to: 106-108

🤖 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 `@src/index.css` around lines 94 - 104, The keyframes animation "fade-in" (and
the similar block at lines 106-108) currently animates filter: blur(), which is
expensive; remove the filter property from both from/to blocks and only animate
opacity and transform (translateY) so the menu opens smoothly on low-end devices
— update the `@keyframes` fade-in and the other keyframe to drop filter: blur(…)
entries and ensure only opacity and transform are animated.

93-109: ⚡ Quick win

Add reduced-motion fallback for the mobile menu animation.

There’s no prefers-reduced-motion handling, so motion-sensitive users still get the transition. Add an opt-out utility override.

Proposed change
 `@layer` utilities{
   `@keyframes` fade-in{
@@
   .ani-fade-in{
     animation: fade-in 0.8s ease-out both;
   }
+
+  `@media` (prefers-reduced-motion: reduce) {
+    .ani-fade-in {
+      animation: none;
+    }
+  }
 }
🤖 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 `@src/index.css` around lines 93 - 109, Add a prefers-reduced-motion fallback
so users who opt out of motion aren't animated: wrap an `@media`
(prefers-reduced-motion: reduce) rule that targets the fade-in keyframes and the
.ani-fade-in utility (the `@keyframes` fade-in and the .ani-fade-in class) and
override the animation to none (and set static properties like opacity:1 and
transform:none if needed) so the mobile menu appears instantly for
reduced-motion users.
🤖 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 `@src/components/Navbar.tsx`:
- Around line 22-29: The useEffect adds a scroll listener but never initializes
scrolled, so call the handler once on mount and add the listener as passive;
specifically, inside the useEffect where handleScroll(), setScrolled, and
window.addEventListener("scroll", handleScroll) are used, invoke handleScroll()
immediately after defining it and change the addEventListener call to use {
passive: true } so the navbar state is correct on initial render and the scroll
listener is passive.

---

Nitpick comments:
In `@src/index.css`:
- Around line 94-104: The keyframes animation "fade-in" (and the similar block
at lines 106-108) currently animates filter: blur(), which is expensive; remove
the filter property from both from/to blocks and only animate opacity and
transform (translateY) so the menu opens smoothly on low-end devices — update
the `@keyframes` fade-in and the other keyframe to drop filter: blur(…) entries
and ensure only opacity and transform are animated.
- Around line 93-109: Add a prefers-reduced-motion fallback so users who opt out
of motion aren't animated: wrap an `@media` (prefers-reduced-motion: reduce) rule
that targets the fade-in keyframes and the .ani-fade-in utility (the `@keyframes`
fade-in and the .ani-fade-in class) and override the animation to none (and set
static properties like opacity:1 and transform:none if needed) so the mobile
menu appears instantly for reduced-motion users.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: e65b63c3-d933-4ca8-ab1a-6fd01978b39f

📥 Commits

Reviewing files that changed from the base of the PR and between e7b8fc8 and 932da92.

📒 Files selected for processing (2)
  • src/components/Navbar.tsx
  • src/index.css

Comment thread src/components/Navbar.tsx
Comment on lines +22 to +29
useEffect( () => {
const handleScroll = () => {
setScrolled(window.scrollY>20);
};

window.addEventListener("scroll",handleScroll);
return () => window.removeEventListener("scroll",handleScroll);
},[]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Initialize scroll-derived state on mount.

scrolled is only set after the first scroll event, so loading a page at a non-zero scroll position renders the wrong navbar style initially. Call the handler once in the effect (and make the listener passive).

Suggested fix
 useEffect( () => {
   const handleScroll = () => {
     setScrolled(window.scrollY>20);
   };

-  window.addEventListener("scroll",handleScroll);
-  return () => window.removeEventListener("scroll",handleScroll);
+  handleScroll();
+  window.addEventListener("scroll", handleScroll, { passive: true });
+  return () => window.removeEventListener("scroll", handleScroll);
 },[]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect( () => {
const handleScroll = () => {
setScrolled(window.scrollY>20);
};
window.addEventListener("scroll",handleScroll);
return () => window.removeEventListener("scroll",handleScroll);
},[]);
useEffect( () => {
const handleScroll = () => {
setScrolled(window.scrollY>20);
};
handleScroll();
window.addEventListener("scroll", handleScroll, { passive: true });
return () => window.removeEventListener("scroll", handleScroll);
},[]);
🤖 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 `@src/components/Navbar.tsx` around lines 22 - 29, The useEffect adds a scroll
listener but never initializes scrolled, so call the handler once on mount and
add the listener as passive; specifically, inside the useEffect where
handleScroll(), setScrolled, and window.addEventListener("scroll", handleScroll)
are used, invoke handleScroll() immediately after defining it and change the
addEventListener call to use { passive: true } so the navbar state is correct on
initial render and the scroll listener is passive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI/UX] Transform Navbar to modern design

1 participant