Overview
TheDotNavigator component provides visual navigation dots for a full-page scrolling experience. It displays 6 dots representing each section of the site, with dynamic styling based on the current scroll position.
Props Interface
The index (0-5) of the currently visible screen/section
Callback function triggered when a dot is clicked to navigate to that section
Mobile device detection flag (currently passed but not actively used in component)
Features
Dynamic Dot Count
The component renders a fixed number of navigation dots:Conditional Styling
Dots change appearance based on three states:Inactive dots on the hero (screen 0) and contact (screen 5) pages have lower opacity (20%) compared to middle sections (50%) for better visual contrast against the dark green background.
Dynamic Icon Selection
The dot color changes based on the current screen:Usage Example
Frompage.tsx:90-91:
Screen Mapping
The 6 screens correspond to:Screen 0: Hero
Dark green background with animated flowers
- Dot icon:
dot1.svg(light) - Background:
bg-dark-green
Screen 1: Statement 1
Mission statement on light background
- Dot icon:
dot2.svg(dark) - Background:
bg-offwhite
Screen 4: Testimonials
Founder testimonials carousel
- Dot icon:
dot2.svg(dark) - Background:
bg-offwhite
Component Structure
Styling Details
- Container
- Dots
- Icons
Base Styles:
- Display:
flex - Gap:
gap-2(8px between dots) - Padding:
p-4(16px all sides) - Shape:
rounded-full(pill shape)
- Hero/Contact:
bg-dark-green - Other sections: No background (transparent)
- Transition:
duration-1000(1 second fade)
Interaction Behavior
Click Navigation
Click Navigation
Hover Effects
Hover Effects
Inactive Dots:
- Cursor changes to pointer
- Scale increases from 100% to 125%
- 300ms transition duration
- Opacity remains constant during hover
- No hover effect (already scaled to 150%)
- Cursor still shows pointer
Visual Feedback
Visual Feedback
Current Position:
- Active dot clearly visible at 150% scale
- 100% opacity vs 20-50% for others
- Inactive dots indicate available sections
- Hover state shows interactivity
- Smooth transitions provide feedback
Responsive Behavior
Desktop Only:- Mobile uses native touch scrolling
- Dots would clutter small screens
- ReactPageScroller optimized for desktop full-page scrolling
- Mobile users can swipe naturally without visual indicators
CSS Classes Breakdown
Integration with ReactPageScroller
- User clicks dot →
onDotClick(index)fires - Parent updates
currentPagestate - ReactPageScroller scrolls to new page
onBeforePageScrollcallback confirms page change- DotNavigator re-renders with new
currentScreen - Active dot updates with scale/opacity transitions
Accessibility Considerations
Pros
- Clickable navigation
- Visual feedback on hover
- Clear active state indicator
- Alt text on dot images
Improvements
- Could use
<button>instead of<img> - Add ARIA labels for screen readers
- Keyboard navigation support (tab + enter)
- Focus visible states
Source Reference
Component:src/components/DotNavigator.tsx (40 lines)
Key Features:
- Fixed 6-screen navigation
- Dynamic styling based on current screen
- Dual color scheme (light/dark dots)
- Hover scale effects
- Container background transitions
- Desktop-only rendering