Navigation Component
The Navigation component provides a dynamic, responsive header menu powered by Notion CMS. It exists in two implementations: a server-rendered Astro component and an interactive Solid.js component.Astro Implementation
Location
~/workspace/source/src/components/Navigation.astro
Props
Whether the navigation bar should be fixed/sticky at the top of the viewport
TypeScript Interface
~/workspace/source/src/components/Navigation.astro:6-8.
Data Source
Navigation items are dynamically loaded from the Notion database specified byNOTION_DB_ID_PAGES. The component queries for:
- Pages where
path ≠ "/"(excludes home page) - Pages where
public = true(only visible pages) - Sorted by
orderproperty (ascending)
~/workspace/source/src/components/Navigation.astro:10-38.
Usage Example
Layout.astro, so you typically don’t need to import it directly.
Rendered Structure
Solid.js Implementation
Location
~/workspace/source/src/components/Navigation.tsx
Props
Array of navigation route objects with
name and path propertiesAdditional CSS classes applied to the
<nav> elementAdditional CSS classes applied to the navigation list (
<ul>) elementTypeScript Interface
~/workspace/source/src/components/Navigation.tsx:7-11.
Features
Responsive Mobile Menu
- Hamburger menu icon on mobile (
mdbreakpoint and below) - Collapsible menu with backdrop overlay
- Smooth transitions and animations
- Works without JavaScript (using
:targetpseudo-class)
Dynamic Border
- Border appears when scrolling down (after 48px scroll)
- Backdrop blur with semi-transparent background
- Transitions smoothly based on scroll position
~/workspace/source/src/components/Navigation.tsx:22-35 for scroll handling logic.
State Management
Usage Example
Managing Navigation Items
To add or modify navigation items:- Open your Notion database (
NOTION_DB_ID_PAGES) - Add a new page with properties:
- title: Display text (e.g., “Blog”)
- path: URL path (e.g., “/blog”)
- order: Numeric sort order
- public: Checkbox (set to true)
- Run
pnpm buildorpnpm devto regenerate the site
Styling
Key styling classes:- Desktop: Horizontal flex layout with gap spacing
- Mobile: Vertical stack with full-width items
- Active state: Underline decoration
- Hover state: Underline and text color change
- Background: Black background with stone-100 text
- Font: Arial, uppercase, bold
~/workspace/source/src/components/Navigation.astro:49-70 for Astro styling.
Related Components
- Layout Component - Includes Navigation automatically
- Icon Component - Used for menu icons in Solid.js version