11import { siteConfig } from "../config/navbarHero" ;
22import Button from "./shared/Button" ;
3- import { useState } from "react" ;
3+ import { useState , useEffect } from "react" ;
44
55export default function Navbar ( ) {
66 const [ mobileMenuOpen , setMobileMenuOpen ] = useState ( false ) ;
77
8+ const [ scrolled , setScrolled ] = useState ( false ) ;
9+
10+ useEffect ( ( ) => {
11+ const handleScroll = ( ) => {
12+ setScrolled ( window . scrollY > 50 ) ;
13+ } ;
14+ window . addEventListener ( "scroll" , handleScroll ) ;
15+
16+ return ( ) => window . removeEventListener ( "scroll" , handleScroll ) ;
17+ } , [ ] ) ;
18+
819 return (
9- < header className = "bg-white w-full px-0 min-[1100px]:sticky fixed top-0 left-0 z-50 " >
20+ < header
21+ className = { `w-full px-0 min-[1100px]:sticky fixed top-0 left-0 z-50 transition-all duration-300 ${
22+ scrolled ? "bg-white/80 backdrop-blur-md shadow-md" : "bg-transparent"
23+ } `}
24+ >
1025 < div className = "max-w-[1920px] w-screen mx-auto px-4 sm:px-6 md:px-8 lg:px-10 py-3 flex items-center text-black font-['Helvetica'] font-normal text-[20px] leading-[100%] tracking-[-0.015em]" >
1126 < div className = "flex items-center space-x-3 min-[900px]:space-x-6 flex-shrink-0" >
1227 < img
@@ -32,10 +47,19 @@ export default function Navbar() {
3247 </ nav >
3348
3449 < div className = "hidden min-[1100px]:flex items-center space-x-4 text-sm flex-shrink-0 ml-auto " >
35- < Button className = "border border-black bg-white text-black px-3 py-1.5 text-sm transition duration-300 ease-in-out hover:bg-[rgba(55,115,236,1)] hover:text-white hover:border-none" >
50+ < Button
51+ backgroundColor = "white"
52+ textColor = "black"
53+ className = "border border-black px-3 py-1.5 text-sm transition duration-300 ease-in-out hover:bg-[rgba(55,115,236,1)] hover:text-white hover:border-none"
54+ >
3655 Join Us
3756 </ Button >
38- < Button className = "bg-[rgba(6,25,70,1)] text-white px-3 py-1.5 text-sm transition duration-300 ease-in-out hover:bg-white hover:text-[rgba(6,25,70,1)]" >
57+
58+ < Button
59+ backgroundColor = "rgba(6,25,70,1)"
60+ textColor = "white"
61+ className = "px-3 py-1.5 text-sm transition duration-300 ease-in-out hover:bg-white hover:text-[rgba(6,25,70,1)]"
62+ >
3963 Contact Us
4064 </ Button >
4165 </ div >
@@ -50,7 +74,6 @@ export default function Navbar() {
5074 fill = "none"
5175 stroke = "currentColor"
5276 viewBox = "0 0 24 24"
53- xmlns = "http://www.w3.org/2000/svg"
5477 >
5578 { mobileMenuOpen ? (
5679 < path
@@ -83,7 +106,6 @@ export default function Navbar() {
83106 fill = "none"
84107 stroke = "currentColor"
85108 viewBox = "0 0 24 24"
86- xmlns = "http://www.w3.org/2000/svg"
87109 >
88110 < path
89111 strokeLinecap = "round"
@@ -108,10 +130,19 @@ export default function Navbar() {
108130 </ nav >
109131
110132 < div className = "mt-8 flex flex-col space-y-4 pt-6 w-full" >
111- < Button className = "w-full border border-white bg-transparent text-white px-4 py-3 text-center text-base transition duration-300 hover:bg-white hover:text-[rgba(6,25,70,1)]" >
133+ < Button
134+ backgroundColor = "transparent"
135+ textColor = "white"
136+ className = "w-full border border-white px-4 py-3 text-center text-base transition duration-300 hover:bg-white hover:text-[rgba(6,25,70,1)]"
137+ >
112138 Join Us
113139 </ Button >
114- < Button className = "w-full bg-white text-[rgba(6,25,70,1)] px-4 py-3 text-center text-base transition duration-300 hover:bg-blue-100" >
140+
141+ < Button
142+ backgroundColor = "white"
143+ textColor = "rgba(6,25,70,1)"
144+ className = "w-full px-4 py-3 text-center text-base transition duration-300 hover:bg-blue-100"
145+ >
115146 Contact Us
116147 </ Button >
117148 </ div >
0 commit comments