import React from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; import { FileText, Trash2 } from 'lucide-react-native'; import { DocumentPickerAsset } from 'expo-document-picker'; interface FileAttachmentCardProps { file: DocumentPickerAsset; onRemove: () => void; } export default function FileAttachmentCard({ file, onRemove }: FileAttachmentCardProps) { // Format size in readable format if available const formatBytes = (bytes?: number) => { if (!bytes) return 'Dimensione sconosciuta'; 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 parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; }; return ( {/* File Icon */} {/* File Info */} {file.name} {formatBytes(file.size)} {/* Remove Button */} ); }