Spaces:
Sleeping
Sleeping
File size: 1,868 Bytes
f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 24bbad4 f6a89c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import React from 'react';
import { Button } from './ui/button';
const FileManager = ({ files, activeFileIndex, onSelectFile, onUploadNew }) => {
if (!files.length) return null;
return (
<div className="mb-6 min-h-[80px]">
<div className="flex justify-between items-center mb-3">
<h3 className="text-md font-medium flex items-center gap-2">
<span role="img" aria-label="files" className="text-lg flex-shrink-0">๐</span>
<span>Your Documents</span>
</h3>
<Button
onClick={onUploadNew}
size="sm"
variant="outline"
className="flex items-center gap-1 text-xs"
>
<span role="img" aria-label="upload" className="flex-shrink-0">๐</span>
<span>Upload New</span>
</Button>
</div>
<div className="overflow-x-auto pb-2 scrollbar-thin">
<div className="flex gap-2 pb-1 min-w-[300px]">
{files.map((file, index) => (
<button
key={index}
onClick={() => onSelectFile(index)}
className={`
px-3 py-2 rounded-md text-sm whitespace-nowrap flex items-center gap-1.5 min-w-0 flex-shrink-0 transition-colors
${activeFileIndex === index
? 'bg-primary text-primary-foreground'
: 'bg-secondary/70 hover:bg-secondary text-secondary-foreground'}
`}
style={{ minWidth: '120px', maxWidth: '200px' }}
>
<span role="img" aria-label="document" className="flex-shrink-0">
{file.name.toLowerCase().endsWith('.pdf') ? '๐' : '๐'}
</span>
<span className="truncate">{file.name}</span>
</button>
))}
</div>
</div>
</div>
);
};
export default FileManager; |