28 lines
705 B
TypeScript
28 lines
705 B
TypeScript
import type { ComponentChildren } from "preact";
|
|
|
|
import { FileIcon } from "@/components/Icons.tsx";
|
|
import { format_bytes } from "@/src/files.ts";
|
|
|
|
interface FileInfoProps {
|
|
name: string;
|
|
size: number;
|
|
detail?: string;
|
|
action?: ComponentChildren;
|
|
}
|
|
|
|
export default function FileInfo(props: FileInfoProps) {
|
|
return (
|
|
<div class="flex w-full flex-row items-center gap-4">
|
|
<FileIcon class="h-8 w-7 flex-none text-white dark:text-gray-900" />
|
|
<div class="min-w-0 flex-1">
|
|
<p class="font-medium break-all">{props.name}</p>
|
|
<p class="pt-1 text-sm opacity-75">
|
|
{format_bytes(props.size)}
|
|
{props.detail && ` · ${props.detail}`}
|
|
</p>
|
|
</div>
|
|
{props.action}
|
|
</div>
|
|
);
|
|
}
|