import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react"; import type { ReactNode } from "react"; import { Logo } from "@/components/site/Logo"; import { splitGallery } from "@/lib/gallery"; import { useI18n } from "@/lib/i18n"; type GalleryProps = { photos: string[]; cinemaName: string; }; type GallerySlotProps = { photo: string | null; alt: string; /** เนื้อหาที่แสดงเมื่อยังไม่มีรูป — ใช้โลโก้ AlterFlixHub แทนข้อความ */ placeholder: ReactNode; className: string; }; function GallerySlot({ photo, alt, placeholder, className }: GallerySlotProps) { if (!photo) { return (
{placeholder}
); } return ( {alt} ); } /** แกลเลอรีภาพโรงหนัง — ป้าย "+N" คำนวณจากจำนวนรูปจริงในข้อมูล */ export function Gallery({ photos, cinemaName }: GalleryProps) { const { messages } = useI18n(); const { main, thumbs, remaining } = splitGallery(photos); const [firstThumb = null, secondThumb = null] = thumbs; return (
} className="aspect-[269/202] w-full lg:aspect-auto lg:h-[606px]" />
} className="aspect-[387/290] w-full" />
} className="aspect-[387/290] w-full" /> {remaining > 0 ? (
{messages.gallery.more(remaining)}
) : null}
); }