-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile-row.tsx
More file actions
66 lines (61 loc) · 1.95 KB
/
file-row.tsx
File metadata and controls
66 lines (61 loc) · 1.95 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { FileIcon, Folder as FolderIcon, Trash2Icon } from "lucide-react";
import Link from "next/link";
import { Button } from "~/components/ui/button";
import { deleteFile } from "~/server/actions";
import type { File, Folder } from "~/server/db/schema";
export function FileRow(props: { file: File }) {
const { file } = props;
return (
<li
key={file.id}
className="hover:bg-gray-750 border-b border-gray-700 px-6 py-4"
>
<div className="grid grid-cols-12 items-center gap-4">
<div className="col-span-6 flex items-center">
<a
href={file.url}
className="flex items-center text-gray-100 hover:text-blue-400"
target="_blank"
>
<FileIcon className="mr-3" size={20} />
{file.name}
</a>
</div>
<div className="col-span-2 text-gray-400">{"File"}</div>
<div className="col-span-3 text-gray-400">{file.size}</div>
<div className="col-span-1 text-right text-gray-400">
<Button
aria-label="Delete file"
variant="ghost"
onClick={() => deleteFile(file.id)}
>
<Trash2Icon className="" size={20} />
</Button>
</div>
</div>
</li>
);
}
export function FolderRow(props: { folder: Folder }) {
const { folder } = props;
return (
<li
key={folder.id}
className="hover:bg-gray-750 border-b border-gray-700 px-6 py-4"
>
<div className="grid grid-cols-12 items-center gap-4">
<div className="col-span-6 flex items-center">
<Link
href={`/f/${folder.id}`}
className="flex items-center text-gray-100 hover:text-blue-400"
>
<FolderIcon className="mr-3" size={20} />
{folder.name}
</Link>
</div>
<div className="col-span-3 text-gray-400"></div>
<div className="col-span-3 text-gray-400"></div>
</div>
</li>
);
}