import { Loader2, X } from "lucide-react"; import Image from "next/image"; import { Button } from "@/components/ui/button"; interface FilePreviewProps { uploadedFile: File; onClear: () => void; isUploading?: boolean; } const formatFileSize = (bytes: number): string => { if (bytes === 0) return "0 Bytes"; const k = 1024; const sizes = ["Bytes", "KB", "MB", "GB"]; const i = Math.floor(Math.log(bytes) / Math.log(k)); return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i]; }; const getFilePreviewUrl = (file: File): string => { if (file.type.startsWith("image/")) { return URL.createObjectURL(file); } return ""; }; export const FilePreview = ({ uploadedFile, onClear, isUploading = false }: FilePreviewProps) => { return (