'use client'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Skeleton } from '@/components/ui/skeleton'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, } from '@/components/ui/empty'; import { Copy, Share2, Image as ImageIcon, FileCode, QrCode } from 'lucide-react'; import type { ExportSize } from '@/types/qrcode'; interface QRPreviewProps { svgString: string; isGenerating: boolean; exportSize: ExportSize; onExportSizeChange: (size: ExportSize) => void; onCopyImage: () => void; onShare: () => void; onDownloadPng: () => void; onDownloadSvg: () => void; } export function QRPreview({ svgString, isGenerating, exportSize, onExportSizeChange, onCopyImage, onShare, onDownloadPng, onDownloadSvg, }: QRPreviewProps) { return ( Preview
Copy image to clipboard Copy shareable URL
Download as PNG v && onExportSizeChange(Number(v) as ExportSize)} variant="outline" size="sm" > 256 512 1k 2k
Download as SVG
{isGenerating ? ( ) : svgString ? (
) : ( Enter text to generate a QR code Type text or a URL in the input field above )}
); }