"use client"; import { motion } from "framer-motion"; import { ArrowRight } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { useEffect, useState } from "react"; import { Button } from "@/components/ui/button"; import { Carousel, type CarouselApi, CarouselContent, CarouselItem, } from "@/components/ui/carousel"; import { cn } from "@/lib/utils"; export interface HeroCarouselSlide { src: string; alt: string; name?: string; title?: string; description?: string; href?: string; } export interface Hero226Props { slides: HeroCarouselSlide[]; slideCtaLabel: string; /** برای دسترسی‌پذیری: تنها h1 معنادار صفحه (معمولاً نام برند) */ pageHeading: string; className?: string; } type Props = Partial; const defaultSlides: HeroCarouselSlide[] = [ { src: "/assets/main-pic/banner-master-decoor.jpg", alt: "نمونه ویترین و دکور", title: "ویترین طلا", description: "نمایش حرفه‌ای و مدیریت ویترین محصولات طلا.", href: "/product?category=vitrin-tala", }, { src: "/assets/main-pic/banner-master-decoor.jpg", alt: "نمونه ویترین خردسال", title: "ویترین خردسال", description: "راهکار ویترین و فرایندهای مرتبط با خردسال.", href: "/product?category=vitrin-khorde-sal", }, { src: "/assets/main-pic/banner-master-decoor.jpg", alt: "نمونه ویترین جواهر", title: "ویترین جواهر", description: "ویترین تخصصی برای جواهر و اقلام پرارزش.", href: "/product?category=vitrin-javaher", }, { src: "/assets/main-pic/banner-master-decoor.jpg", alt: "نمونه دکور فروشگاه", title: "دکور و جعبه", description: "ترکیبی از تنوع، ظرافت و کیفیت برای فضای فروش شما.", href: "/about", }, { src: "/assets/main-pic/banner-master-decoor.jpg", alt: "نمونه راهکار سفارشی", title: "راهکار سفارشی", description: "طراحی و تولید متناسب با مدل کاری مجموعه شما.", href: "/consultation", }, ]; const defaultProps: Required> = { slides: defaultSlides, slideCtaLabel: "مشاهده", pageHeading: "مستر دکور", }; function isExternalHref(href: string) { return href.startsWith("http://") || href.startsWith("https://"); } function SlideCtaLink({ href, slideCtaLabel, }: { href: string; slideCtaLabel: string; }) { const className = "group gap-2 rounded-full border border-gold-400/55 bg-background/15 px-4 py-2 text-body font-medium tracking-tight text-gold-300 backdrop-blur-sm hover:border-gold-400/75 hover:bg-gold-950/35 hover:text-gold-200"; const icon = ( ); if (isExternalHref(href)) { return ( ); } return ( ); } export function Hero226(props: Props) { const [api, setApi] = useState(); const [current, setCurrent] = useState(0); const { slides, slideCtaLabel, pageHeading, className } = { ...defaultProps, ...props, }; useEffect(() => { if (!api) return; const onSelect = () => setCurrent(api.selectedScrollSnap()); onSelect(); api.on("select", onSelect); return () => { api.off("select", onSelect); }; }, [api]); return (

{pageHeading}

{slides.map((img, index) => (
{img.alt}
{/* هر اسلاید h2 است؛ h1 فقط sr-only بالای سکشن (استاندارد تایپوگرافی) */}

{img.title ?? ""}

{img.description ?? ""}

))}
{slides.map((_, index) => (
); }