Header component provides the main site navigation with a logo and responsive menu. It includes active state highlighting and smooth hover effects.
Features
- RobTop Games logo with hover scale effect
- Responsive navigation menu with mobile toggle
- Active page highlighting
- Bootstrap Icons integration
- Glassmorphism effect on mobile menu
Usage
- Basic Usage
- In Layout
src/layouts/Layout.astro
Component Code
The Header component doesn’t accept props and automatically detects the current page:src/components/Header.astro
Active State Logic
The component usesAstro.url.pathname to determine which navigation item should be highlighted:
- Home page: Exact match (
pathname === '/') - Other pages: Prefix match (
pathname.startsWith(href))
Menu Items Configuration
The navigation menu is configured with an array of objects:Styling Features
Logo Hover Effect
Active Navigation Item
Mobile Menu Styling
On mobile devices (< 991px), the collapsed menu has a glassmorphism effect:Customization
To add or modify menu items, edit themenuItems array:
src/components/Header.astro
