"use client" import useEmblaCarousel from "embla-carousel-react" import { ChevronLeft, ChevronRight } from "lucide-react" import { useCallback } from "react" import CardNormal from "../Cards/CardNormal" import Autoplay from "embla-carousel-autoplay" import Link from "next/link" import { useLocale, useTranslations } from "next-intl" export default function ProductCarousel({ title, subtitle, products, showMoreLink }) { const t = useTranslations("Utils") const locale = useLocale() const [emblaRef, emblaApi] = useEmblaCarousel( { loop: true, align: "start", direction: locale === "en" ? "ltr" : "rtl" }, [ Autoplay({ delay: 3000, stopOnInteraction: true }), ] ) const scrollPrev = useCallback(() => { if (emblaApi) emblaApi.scrollPrev() }, [emblaApi]) const scrollNext = useCallback(() => { if (emblaApi) emblaApi.scrollNext() }, [emblaApi]) return (

{title}

{ subtitle &&

{subtitle}

}
{ showMoreLink && {t("showMoreLink")} }
{products.map((product) => (
))}
) }