'use client'; import * as React from 'react'; import { ChevronLeft, ChevronRight, X, ZoomIn } from 'lucide-react'; import { cn } from '@/lib/utils'; interface DocumentFullscreenViewerProps { images: { storageKey: string; url: string }[]; initialIndex?: number; open: boolean; onOpenChange: (open: boolean) => void; } export function DocumentFullscreenViewer({ images, initialIndex = 0, open, onOpenChange }: DocumentFullscreenViewerProps) { const [index, setIndex] = React.useState(initialIndex); React.useEffect(() => { if (open) setIndex(initialIndex); }, [initialIndex, open]); React.useEffect(() => { if (!open) return; function onKeyDown(event: KeyboardEvent) { if (event.key === 'Escape') onOpenChange(false); if (event.key === 'ArrowLeft') setIndex((current) => Math.max(0, current - 1)); if (event.key === 'ArrowRight') setIndex((current) => Math.min(images.length - 1, current + 1)); } window.addEventListener('keydown', onKeyDown); return () => window.removeEventListener('keydown', onKeyDown); }, [images.length, onOpenChange, open]); if (!open || images.length === 0) return null; const current = images[index]; return (
{index + 1} / {images.length}
{images.length > 1 ? ( ) : null} {/* eslint-disable-next-line @next/next/no-img-element */} Фото документа {images.length > 1 ? ( ) : null}
); } interface DocumentPhotoThumbnailProps { url?: string; loading?: boolean; className?: string; onClick?: () => void; } export function DocumentPhotoThumbnail({ url, loading, className, onClick }: DocumentPhotoThumbnailProps) { return ( ); }