'use client'; import { forwardRef, HTMLAttributes } from 'react'; import styles from './progress-dots.module.css'; export interface ProgressDotItem { id: string; label?: string; href?: string; } export interface ProgressDotsProps extends HTMLAttributes { items: ProgressDotItem[]; activeId?: string; variant?: 'default' | 'gold' | 'minimal'; direction?: 'vertical' | 'horizontal'; showConnector?: boolean; onDotClick?: (id: string) => void; } export const ProgressDots = forwardRef( ({ items, activeId, variant = 'default', direction = 'vertical', showConnector = false, onDotClick, className, ...props }, ref) => { const containerClasses = [ styles.container, variant === 'gold' && styles.variantGold, variant === 'minimal' && styles.variantMinimal, direction === 'horizontal' && styles.horizontal, showConnector && styles.withConnector, className, ].filter(Boolean).join(' '); const handleClick = (id: string, href?: string) => { if (onDotClick) { onDotClick(id); } if (href) { const el = document.querySelector(href); el?.scrollIntoView({ behavior: 'smooth' }); } }; return (
{items.map((item) => ( ))}
); } ); ProgressDots.displayName = 'ProgressDots'; export default ProgressDots;