"use client"; import React, { useState } from 'react'; import Image from 'next/image'; interface ProductGalleryProps { image: string; name: string; images?: string[]; // opcjonalna dodatkowa galeria z contentu, u nas na razie w mocku mamy 1 image } export function ProductGallery({ image, name, images }: ProductGalleryProps) { const [mainImage, setMainImage] = useState(image || 'https://images.unsplash.com/photo-1581094794329-c8112a89af12?w=800&q=80'); // Tworzymy tablicę miniatur, używamy placeholdera jako drugiej by pokazać funkcjonalność const gallery = images && images.length > 0 ? images : [image, 'https://images.unsplash.com/photo-1584622650111-993a426fbf0a?w=800&q=80']; return (
{/* Główne zdjęcie */}
{name}
{/* Miniatury */} {gallery.length > 1 && (
{gallery.map((img, idx) => ( ))}
)}
); }