Navbar component provides a fixed, responsive navigation bar with glassmorphism effects, dropdown menus, and mobile support.
Features
- Fixed positioning with scroll-based background changes
- Centered desktop menu with glassmorphism pill design
- Dynamic dropdown menu for solutions/services
- Mobile hamburger menu with slide-down panel
- Active route highlighting
- Auto-close on route change
Usage
Component Props
The Navbar component does not accept any props. It’s a self-contained component that reads navigation data fromsiteContent.navigation.
State Management
The component manages several internal state variables:Controls the mobile menu visibility
Tracks whether the user has scrolled past 20px, triggering background changes
Controls the mobile solutions dropdown visibility
Data Structure
The Navbar reads navigation links fromsiteContent.navigation, which should be an array of NavLink objects:
Key Features
Scroll Effect
The navbar changes appearance when scrolled:scrolled is true:
- Applies
glass-panelclass with blur effect - Adds bottom border
- Reduces vertical padding
Desktop Menu Layout
The desktop menu is absolutely centered using:Solutions Dropdown
A special dropdown menu is injected after the “Nosotros” link:- Hover-triggered on desktop
- Click-triggered on mobile
- Displays solution items from
siteContent.solutions.items - Links to
/soluciones/{slug}paths
Active Link Styling
Links use React Router’sNavLink with active state detection:
Mobile Menu
The mobile menu:- Appears below
mdbreakpoint - Slides down with smooth height transition
- Auto-closes on route change via
useEffect - Includes expandable solutions submenu
Styling Classes
Key CSS classes used:glass-panel: Semi-transparent background with backdrop blurglass-button: Button with glass effectbrand-green: Primary green accent colorborder-white/5: Subtle white border with 5% opacity
Integration with Site Content
The component integrates with the centralizedsiteContent data:
siteContent.navigation: Main navigation linkssiteContent.header.logo: Logo imagesiteContent.header.cta: Call-to-action button configsiteContent.solutions.items: Dropdown menu items
Example Navigation Data
Component Location
components/Navbar.tsx:10