import { Link } from '@tanstack/react-router';
import { ChevronRight } from 'lucide-react';

interface ShelfRowProps {
  title: string;
  viewAllTo?: string;
  children: React.ReactNode;
}

export function ShelfRow({ title, viewAllTo, children }: ShelfRowProps) {
  return (
    <section className="space-y-3">
      <div className="flex items-center justify-between">
        <h2 className="text-lg font-bold text-text">{title}</h2>
        {viewAllTo && (
          <Link to={viewAllTo} className="flex items-center gap-0.5 text-xs text-muted hover:text-accent transition-colors">
            View all <ChevronRight size={14} />
          </Link>
        )}
      </div>
      <div className="flex gap-4 overflow-x-auto pb-2 scrollbar-hide">
        {children}
      </div>
    </section>
  );
}
