Spaces:
Build error
Build error
Upload components/EmailList.js with huggingface_hub
Browse files- components/EmailList.js +58 -0
components/EmailList.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Star, Archive, Trash2, Mail } from 'lucide-react';
|
| 2 |
+
|
| 3 |
+
export default function EmailList({ emails, selectedId, setSelectedId }) {
|
| 4 |
+
return (
|
| 5 |
+
<div className="w-full max-w-md bg-white border-r border-slate-200 flex flex-col shrink-0">
|
| 6 |
+
<div className="p-4 border-b border-slate-100 flex items-center justify-between">
|
| 7 |
+
<h2 className="font-semibold text-slate-700">Messages</h2>
|
| 8 |
+
<div className="flex gap-1">
|
| 9 |
+
<button className="p-1.5 hover:bg-slate-100 rounded text-slate-500">
|
| 10 |
+
<Mail size={16} />
|
| 11 |
+
</button>
|
| 12 |
+
</div>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<div className="flex-1 overflow-y-auto">
|
| 16 |
+
{emails.length === 0 ? (
|
| 17 |
+
<div className="p-8 text-center text-slate-400 text-sm">
|
| 18 |
+
No messages found matching your search.
|
| 19 |
+
</div>
|
| 20 |
+
) : (
|
| 21 |
+
emails.map((email) => (
|
| 22 |
+
<div
|
| 23 |
+
key={email.id}
|
| 24 |
+
onClick={() => setSelectedId(email.id)}
|
| 25 |
+
className={`group relative p-4 border-b border-slate-100 cursor-pointer transition-all ${
|
| 26 |
+
selectedId === email.id
|
| 27 |
+
? 'bg-blue-50 border-l-4 border-l-gmail-blue'
|
| 28 |
+
: 'hover:bg-slate-50 border-l-4 border-l-transparent'
|
| 29 |
+
} ${!email.read ? 'bg-white font-bold' : 'bg-slate-50/30 font-normal'}`}
|
| 30 |
+
>
|
| 31 |
+
<div className="flex justify-between items-start mb-1">
|
| 32 |
+
<span className={`text-sm ${!email.read ? 'text-slate-900' : 'text-slate-600'}`}>
|
| 33 |
+
{email.sender}
|
| 34 |
+
</span>
|
| 35 |
+
<span className="text-xs text-slate-400">{email.date}</span>
|
| 36 |
+
</div>
|
| 37 |
+
<div className={`text-sm truncate mb-1 ${!email.read ? 'text-slate-900' : 'text-slate-600'}`}>
|
| 38 |
+
{email.subject}
|
| 39 |
+
</div>
|
| 40 |
+
<div className="text-xs text-slate-400 truncate">
|
| 41 |
+
{email.body}
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
<div className="absolute right-2 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 flex gap-1 transition-opacity">
|
| 45 |
+
<button className="p-1.5 hover:bg-slate-200 rounded-full text-slate-500">
|
| 46 |
+
<Archive size={14} />
|
| 47 |
+
</button>
|
| 48 |
+
<button className="p-1.5 hover:bg-slate-200 rounded-full text-slate-500">
|
| 49 |
+
<Trash2 size={14} />
|
| 50 |
+
</button>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
))
|
| 54 |
+
)}
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
);
|
| 58 |
+
}
|