Header component provides the main navigation bar for the Chapinismos site. It includes the site logo, navigation menu, language switcher, and theme toggle, with responsive behavior for mobile and desktop views.
Import
Usage
The Header component is typically used in the Base layout and doesn’t require any props:src/layouts/Base.astro
Props
The Header component does not accept any props. It automatically detects the current language from the URL usinggetLangFromUrl(Astro.url).
Features
Language Detection
The component automatically detects the current language and sets the appropriate URL prefix:Responsive Layout
- Desktop: Shows full navigation with all controls inline
- Mobile: Shows language switcher, theme toggle, and mobile menu button
Components Included
- Logo: Site branding that links to the home page
- Navigation: Main navigation links (desktop only)
- LanguageSwitcher: Toggle between English and Spanish
- ThemeToggle: Switch between light and dark modes
- MobileMenu: Hamburger menu for mobile devices
Structure
Analytics
The logo link includes Umami analytics tracking:View Transitions
The header uses Astro’s View Transitions API withtransition:persist to maintain state during page navigation:
Styling
The component includes custom styles for:- Responsive breakpoints using
@media (min-width: 480px) - Guatemala flag badge styling with theme-aware gradients
- Drop shadow effects that adapt to dark/light themes
- Hover states with scale transforms
Related Components
- Navigation - Desktop navigation links
- MobileMenu - Mobile hamburger menu
- LanguageSwitcher - Language toggle
- ThemeToggle - Dark/light mode toggle