2024-11-20 01:37:23 +00:00
|
|
|
// Remove the lucide-react import
|
2024-11-19 00:55:28 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2024-11-20 01:37:23 +00:00
|
|
|
// Rest of the interface remains the same
|
2024-11-19 00:55:28 +00:00
|
|
|
interface FilePreviewProps {
|
|
|
|
files: File[];
|
2024-11-20 01:37:23 +00:00
|
|
|
imageDataList: string[];
|
2024-11-19 00:55:28 +00:00
|
|
|
onRemove: (index: number) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const FilePreview: React.FC<FilePreviewProps> = ({ files, imageDataList, onRemove }) => {
|
|
|
|
if (!files || files.length === 0) {
|
2024-11-20 01:37:23 +00:00
|
|
|
return null;
|
2024-11-19 00:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-11-20 01:37:23 +00:00
|
|
|
<div className="flex flex-row overflow-x-auto">
|
2024-11-19 00:55:28 +00:00
|
|
|
{files.map((file, index) => (
|
|
|
|
<div key={file.name + file.size} className="mr-2 relative">
|
|
|
|
{imageDataList[index] && (
|
|
|
|
<div className="relative">
|
|
|
|
<img src={imageDataList[index]} alt={file.name} className="max-h-20" />
|
|
|
|
<button
|
|
|
|
onClick={() => onRemove(index)}
|
|
|
|
className="absolute -top-2 -right-2 z-10 bg-white rounded-full p-1 shadow-md hover:bg-gray-100"
|
|
|
|
>
|
|
|
|
<div className="bg-black rounded-full p-1">
|
2024-11-20 01:37:23 +00:00
|
|
|
<div className="i-ph:x w-3 h-3 text-gray-400" />
|
2024-11-19 00:55:28 +00:00
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FilePreview;
|