'use client'; import { forwardRef, HTMLAttributes } from 'react'; import styles from '../timeline-nav.module.css'; export interface TimelineEra { /** Era identifier/index */ value: string | number; /** Label to display (e.g., year or era name) */ label: string; /** Optional aria label for accessibility */ ariaLabel?: string; /** Whether this era is currently active */ active?: boolean; /** Additional data attributes */ data?: Record; } export interface TimelineNavProps extends HTMLAttributes { /** Array of eras/timeline points */ eras: TimelineEra[]; /** Orientation of the timeline */ orientation?: 'horizontal' | 'vertical'; /** Callback when an era is clicked */ onEraClick?: (era: TimelineEra, index: number) => void; /** Show labels */ showLabels?: boolean; /** Show connecting line */ showLine?: boolean; /** Dot size */ dotSize?: 'small' | 'medium' | 'large'; } export const TimelineNav = forwardRef( ( { eras, orientation = 'horizontal', onEraClick, showLabels = true, showLine = true, dotSize = 'medium', className, ...props }, ref ) => { return ( {showLine && } {eras.map((era, index) => ( onEraClick?.(era, index)} aria-label={era.ariaLabel || `Era: ${era.label}`} aria-current={era.active ? 'step' : undefined} {...era.data} > {showLabels && {era.label}} ))} ); } ); TimelineNav.displayName = 'TimelineNav'; export default TimelineNav;