import { useStorefront } from '../context'; import { ProductCard } from '../product-card'; import { storefrontText } from '../text'; import { formatPrice } from '../theme'; import type { ProductGridSection } from '../types'; import { Container, ImagePlaceholder, SectionHeading, SfButton } from '../ui'; /** How many real products the home page shows before "View all". */ const maxShown = 8; /** * Shows the merchant's real products when there are any. * Until then it shows the example items the AI wrote, so a new store never looks empty. */ export function ProductGrid({ section }: { section: ProductGridSection }) { const { heading, subheading, items } = section.content; const minimal = section.variant === 'minimal'; const { products, language } = useStorefront(); const t = storefrontText(language); const hasProducts = products.length > 0; return (
{hasProducts && !minimal && ( {t.viewAll} )}
{hasProducts && minimal && (
{t.viewAll}
)}
); }