import InfiniteScroll from "react-infinite-scroll-component"; import ProductCard from "@/features/home/components/ProductCard"; import type { Product } from "@/lib/types/api"; interface CollectionProductsGridProps { products: Product[]; hasMore: boolean; isFetching?: boolean; onLoadMore: () => void; translations: { loading: string; no_results: string; }; } export default function CollectionProductsGrid({ products, hasMore, onLoadMore, isFetching = false, translations, }: CollectionProductsGridProps) { if (products.length === 0 && !isFetching) { return (
{translations.no_results}
); } return (
{translations.loading}
} endMessage={ products.length > 0 && !hasMore ? (
) : null } >
{products.map((product) => ( ))}
{isFetching && products.length === 0 && (
{Array.from({ length: 6 }).map((_, i) => (
))}
)} ); }