@@ -6,11 +6,9 @@ import {
66 AnimatePresence ,
77 useScroll ,
88 useMotionValueEvent ,
9- } from "motion/react" ;
10-
9+ } from "framer-motion" ; // ✅ corrected import path
1110import React , { useRef , useState } from "react" ;
1211
13-
1412interface NavbarProps {
1513 children : React . ReactNode ;
1614 className ?: string ;
@@ -58,17 +56,12 @@ export const Navbar = ({ children, className }: NavbarProps) => {
5856 const [ visible , setVisible ] = useState < boolean > ( false ) ;
5957
6058 useMotionValueEvent ( scrollY , "change" , ( latest ) => {
61- if ( latest > 100 ) {
62- setVisible ( true ) ;
63- } else {
64- setVisible ( false ) ;
65- }
59+ setVisible ( latest > 100 ) ;
6660 } ) ;
6761
6862 return (
6963 < motion . div
7064 ref = { ref }
71- // IMPORTANT: Change this to class of `fixed` if you want the navbar to be fixed
7265 className = { cn ( "fixed inset-x-0 top-4 z-40 w-full" , className ) }
7366 >
7467 { React . Children . map ( children , ( child ) =>
@@ -88,7 +81,8 @@ export const NavBody = ({ children, className, visible }: NavBodyProps) => {
8881 < motion . div
8982 animate = { {
9083 backdropFilter : "blur(20px)" ,
91- boxShadow : "0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1) inset" ,
84+ boxShadow :
85+ "0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1) inset" ,
9286 width : visible ? "40%" : "100%" ,
9387 y : visible ? 20 : 0 ,
9488 } }
@@ -101,11 +95,13 @@ export const NavBody = ({ children, className, visible }: NavBodyProps) => {
10195 minWidth : "800px" ,
10296 } }
10397 className = { cn (
104- "relative z-[60] mx-auto hidden w-full max-w-7xl flex-row items-center justify-between self-start rounded-full bg-white/10 px-4 py-2 lg:flex border border-white/20" ,
98+ "relative z-[60] mx-auto hidden w-full max-w-7xl flex-row items-center justify-between rounded-full bg-white/10 px-4 py-2 lg:flex border border-white/20" ,
10599 className ,
106100 ) }
107101 >
108- { children }
102+ < div className = "flex w-full items-center justify-between" >
103+ { children }
104+ </ div >
109105 </ motion . div >
110106 ) ;
111107} ;
@@ -114,10 +110,11 @@ export const NavItems = ({ items, className, onItemClick }: NavItemsProps) => {
114110 const [ hovered , setHovered ] = useState < number | null > ( null ) ;
115111
116112 return (
117- < motion . div
113+ < div
118114 onMouseLeave = { ( ) => setHovered ( null ) }
119115 className = { cn (
120- "absolute inset-0 hidden flex-1 flex-row items-center justify-center space-x-2 text-sm font-medium text-zinc-600 transition duration-200 hover:text-zinc-800 lg:flex lg:space-x-2" ,
116+ // ✅ removed absolute/inset-0 — no more overlap
117+ "hidden lg:flex flex-1 items-center justify-center space-x-2 text-sm font-medium text-zinc-600 transition duration-200 hover:text-zinc-800" ,
121118 className ,
122119 ) }
123120 >
@@ -138,7 +135,7 @@ export const NavItems = ({ items, className, onItemClick }: NavItemsProps) => {
138135 < span className = "relative z-20" > { item . name } </ span >
139136 </ a >
140137 ) ) }
141- </ motion . div >
138+ </ div >
142139 ) ;
143140} ;
144141
@@ -232,7 +229,6 @@ export const NavbarLogo = () => {
232229 href = "#"
233230 className = "relative z-20 mr-4 flex items-center space-x-2 px-2 py-1 text-sm font-normal text-black"
234231 >
235- { /* eslint-disable-next-line @next/next/no-img-element */ }
236232 < img
237233 src = "https://assets.aceternity.com/logo-dark.png"
238234 alt = "logo"
@@ -262,7 +258,7 @@ export const NavbarButton = ({
262258 | React . ComponentPropsWithoutRef < "button" >
263259) ) => {
264260 const baseStyles =
265- "px-4 py-2 rounded-md bg-white button bg-white text-black text-sm font-bold relative cursor-pointer hover:-translate-y-0.5 transition duration-200 inline-block text-center" ;
261+ "px-4 py-2 rounded-md bg-white text-black text-sm font-bold relative cursor-pointer hover:-translate-y-0.5 transition duration-200 inline-block text-center flex-shrink-0" ; // ✅ added flex-shrink-0
266262
267263 const variantStyles = {
268264 primary :
0 commit comments