import React, { useMemo } from 'react';
import { Camera } from 'lucide-react';
import { ThemeConfig, GalleryLayoutType } from '../../types/theme.types';
interface GalleryPreviewProps {
theme: ThemeConfig;
layoutType?: GalleryLayoutType;
className?: string;
}
// Mock photo data for preview
const generateMockPhotos = (count: number) => {
return Array.from({ length: count }, (_, i) => ({
id: i + 1,
filename: `photo-${i + 1}.jpg`,
url: '',
thumbnail_url: '',
type: i % 3 === 0 ? 'collage' : 'individual',
category_id: (i % 4) + 1,
category_name: ['Ceremony', 'Reception', 'Portraits', 'Party'][i % 4],
category_slug: ['ceremony', 'reception', 'portraits', 'party'][i % 4],
size: Math.floor(Math.random() * 5000000) + 1000000,
uploaded_at: new Date().toISOString(),
}));
};
// Preview photo component
const PreviewPhoto: React.FC<{
photo: any;
className?: string;
aspectRatio?: string;
}> = ({
photo,
className = '',
aspectRatio = 'aspect-square'
}) => (
{photo.filename}
{photo.category_name && (
{photo.category_name}
)}
{photo.type === 'collage' && (
Collage
)}
);
export const GalleryPreview: React.FC = ({
theme,
layoutType,
className = ''
}) => {
const mockPhotos = useMemo(() => generateMockPhotos(12), []);
// Use the provided layoutType or fallback to theme's gallery layout
const activeLayout = layoutType || theme.galleryLayout || 'grid';
const renderLayout = () => {
const spacing = theme.gallerySettings?.spacing || 'normal';
const gapClass = spacing === 'tight' ? 'gap-1' : spacing === 'relaxed' ? 'gap-4' : 'gap-2';
switch (activeLayout) {
case 'grid': {
return (
{mockPhotos.slice(0, 8).map((photo) => (
))}
);
}
case 'masonry':
return (
{mockPhotos.slice(0, 10).map((photo, idx) => (
))}
);
case 'carousel':
return (
{[0, 1, 2, 3].map((idx) => (
))}
);
case 'timeline':
return (
{['Today', 'Yesterday'].map((date, dateIdx) => (
{date}
{mockPhotos.slice(dateIdx * 3, (dateIdx * 3) + 3).map((photo) => (
))}
))}
);
case 'hero':
return (
{mockPhotos.slice(1, 5).map((photo) => (
))}
);
case 'mosaic':
return (
);
default:
return null;
}
};
return (
{/* Preview Header */}
Gallery Preview - {activeLayout} Layout
{/* Preview Content */}
{renderLayout()}
);
};
GalleryPreview.displayName = 'GalleryPreview';