AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

product-grid.tsx 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { formatPrice } from '../theme';
  2. import type { ProductGridSection } from '../types';
  3. import { Container, ImagePlaceholder, SectionHeading } from '../ui';
  4. export function ProductGrid({ section }: { section: ProductGridSection }) {
  5. const { heading, subheading, items } = section.content;
  6. const minimal = section.variant === 'minimal';
  7. return (
  8. <section id={section.id} className="scroll-mt-20 py-16 md:py-20">
  9. <Container>
  10. <SectionHeading
  11. heading={heading}
  12. subheading={subheading}
  13. align={minimal ? 'center' : 'left'}
  14. />
  15. <ul className="mt-10 grid grid-cols-2 gap-x-5 gap-y-9 lg:grid-cols-4">
  16. {items.map((item, index) => (
  17. <li key={item.name + index} className="group">
  18. <div className="relative">
  19. <ImagePlaceholder
  20. seed={index}
  21. label={item.name}
  22. className="aspect-[4/5] w-full"
  23. />
  24. {item.badge && (
  25. <span className="absolute top-3 left-3 rounded-(--sf-radius) bg-(--sf-fg) px-2.5 py-1 text-xs font-semibold text-(--sf-bg)">
  26. {item.badge}
  27. </span>
  28. )}
  29. </div>
  30. <div
  31. className={
  32. minimal
  33. ? 'mt-4 text-center'
  34. : 'mt-4 flex flex-col gap-1 sm:flex-row sm:items-baseline sm:justify-between sm:gap-3'
  35. }
  36. >
  37. <h3 className="font-medium">{item.name}</h3>
  38. <p className="text-sm text-(--sf-muted) tabular-nums">
  39. {formatPrice(item.price)}
  40. </p>
  41. </div>
  42. </li>
  43. ))}
  44. </ul>
  45. </Container>
  46. </section>
  47. );
  48. }