Skip to content

Conversation

@kunalbatra339
Copy link

Fixes: #3429

Updated the FloatingNavbar component to use 'max-w-7xl' in the scrolled state.
This ensures the navbar maintains correct alignment with the main blog content
instead of shrinking to a narrow pill shape.

Screenshot 2026-01-04 194650

Signed-off-by: kunalbatra339 <kbatra339@gmail.com>
@amaan-bhati amaan-bhati self-requested a review January 5, 2026 19:09
Copy link
Member

@amaan-bhati amaan-bhati left a comment

Choose a reason for hiding this comment

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

Hey @kunalbatra339 Thanks for raising this pr, the idea of simply increasing the width of the navbar is good, it might help align the navbar width to the the hero section like this:

Image

But in cases when the navbar shrinks, it needs to align to the other sections as well, since the navbar remains entact all the time, the ideais to create a good user experience so that they dont need to move their eyes much, hence, when we get to reach these sectios, the navbar needs to shrink to match their width, in this case we can start with the making the navbar have the same width as the hero section as it is right now in case of shrinking, and when we scroll down to other sections, it's width decreses to match their width for an attention to fetail, i have attached the reference images for what i am talking about here for the better understanding of the issue:

Image
Image

Signed-off-by: kunalbatra339 <kbatra339@gmail.com>
@kunalbatra339
Copy link
Author

@amaan-bhati I've implemented the two-stage shrink logic as requested! I also added a requestAnimationFrame throttle to the scroll event listener to ensure the animation remains buttery smooth (60fps) even on lower-end devices. Logic:

Hero Stage: Expands to 85% width when scrolling starts (matching the Hero).

Content Stage: Smoothly shrinks to max-w-7xl after passing the Hero section (~750px) to align with the blog content.

@amaan-bhati amaan-bhati self-requested a review January 7, 2026 10:10
Copy link
Member

@amaan-bhati amaan-bhati left a comment

Choose a reason for hiding this comment

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

Hey @kunalbatra339 thanks for following up on the review, i tried it again on the local and have a few suggestions:

  • the inital state of the navbar looks good and should stay the same till we get past the hero seciton since the alignment of the navbar matches the hero section in the initial state. image for reference:
Image
- The alignment of the navbar when shrinked, instead of getting reduced, it increases and does not matches the width of the other sections and there is a clear gap between the navbar and the sections while scrolling, this gap needs to get removed and the navbar should be aligned in a way that it matches the length of the other sections after scrolling past the hero section, i have attachd the image for reference and better understanding of the issue: Image

@kunalbatra339
Copy link
Author

@amaan-bhati I've updated the logic based on your screenshot! You were right—the intermediate width was causing a gap.

Fixes applied:

Removed the width expansion: The navbar now stays strictly at max-w-7xl in both states to ensure perfect vertical alignment with the blog content cards.

Delayed Transition: As requested, the "initial state" now persists until the user scrolls past the Hero section (~760px). The "Pill" style only activates once we enter the content area, creating a cleaner transition.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants