Overview
Navigation components provide consistent site-wide navigation and branding. They’re located insrc/components/navigation/.
Header
A responsive navigation header with mobile menu support and scroll-based styling.Props
Array of navigation items:
Link text
Link URL
Link target (e.g.,
"_blank" for external links)Site name displayed in logo
If
true, header has static white background. If false, header is transparent on top and becomes white on scroll.Usage
Features
Dynamic Mode (isStatic={false})
Used on the home page with hero section:
- Above scroll threshold: Transparent background, white text
- Below scroll threshold (50px): White background, colored text, shadow
- Smooth color transitions on scroll
Static Mode (isStatic={true})
Used on other pages:
- Always white background
- Always colored text
- Always has shadow
- Adds spacing below header (
h-16spacer)
Mobile Menu
- Hamburger icon on small screens
- Full-screen overlay menu
- Smooth slide animation
- Accessible with
aria-expanded
Responsive Design
- Desktop: Horizontal menu (
md:flex) - Mobile: Hamburger menu icon
- Logo always visible
- Smooth transitions between states
Behavior
The header includes client-side JavaScript for:- Scroll detection: Changes styling at 50px scroll
- Mobile menu toggle: Opens/closes overlay
- Dynamic styling: Updates colors and shadows
Styling Customization
The header styling is controlled by JavaScript that toggles Tailwind classes:Example Navigation Data
Footer
A simple footer with copyright and social links.Props
Site name for copyright notice
Usage
Features
- Automatic current year in copyright
- Responsive layout (stacked on mobile, horizontal on desktop)
- Integrated
SocialLinkscomponent - Light gray background (
bg-gray-100) - Top margin separation from content
Social Links Component
The footer uses theSocialLinks component internally, which renders:
- Icon buttons for each social link
- Hover effects
- Accessible labels
- External link handling
Layout Integration
Main Layout (Home Page)
Static Layout (Other Pages)
Accessibility
Header
- Mobile menu button: Has
aria-expandedattribute - Mobile menu button: Has
aria-label="Toggle menu" - External links: Automatically include
target="_blank" - Keyboard navigation: All links are keyboard accessible
Footer
- Social links: Each has descriptive
labelfor screen readers - External links: Use
relattribute for security - Semantic HTML: Uses
<footer>element
Customization
Changing Colors
Edit the header scroll behavior inHeader.astro:86-99:
Adding Footer Links
Extend the footer by editingFooter.astro:
Best Practices
Navigation Structure
- Keep navigation items concise (4-6 items)
- Put most important pages first
- Use external link icons for clarity
- Group related pages in the future with dropdowns
Mobile Experience
- Test mobile menu on real devices
- Ensure touch targets are large enough (44x44px minimum)
- Provide visual feedback for active page
- Consider adding page transitions
Performance
- Header JavaScript is inline for instant interactivity
- Minimize reflows by toggling classes instead of inline styles
- Use CSS transitions for smooth animations
Common Navigation Components
These utility components enhance navigation and user interaction.BackLink
A back navigation link with an arrow icon, useful for detail pages.Props
The URL to navigate back to (e.g.,
/projects, /blog).The label text for the back link (e.g., “Projects”, “Blog”).
Usage
src/pages/project/[id].astro
Output
Renders: ← Back to Projects (with hover effect changing color to red-700)ShareButtons
Social media share buttons for blog posts or project pages.Props
The full URL to share (e.g.,
https://aviv.sh/blog/post-slug).The title of the content being shared.
A brief description of the content.
Usage
src/pages/blog/[slug].astro
Supported Platforms
- X (Twitter)
SocialLinks
Displays a horizontal list of social media icons with links.Props
Array of social link objects with
href, icon, and label properties.Usage
src/components/navigation/Footer.astro
SocialLink Type
Related Components
UI Elements
Learn about Icon and other UI components used in navigation
Sections
See how navigation integrates with page sections
