mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-20 02:23:20 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import { Link } from '@inertiajs/react';
|
||
import { type LucideIcon } from 'lucide-react';
|
||
|
||
interface StatTileProps {
|
||
label: string;
|
||
value: string;
|
||
hint?: string;
|
||
icon: LucideIcon;
|
||
accentClassName: string;
|
||
iconClassName: string;
|
||
href?: string;
|
||
/** 0–100. Renders a slim usage bar under the hint, red past 90%. */
|
||
progress?: number;
|
||
}
|
||
|
||
export function StatTile({ label, value, hint, icon: Icon, accentClassName, iconClassName, href, progress }: StatTileProps) {
|
||
const content = (
|
||
<>
|
||
<div className="flex items-center gap-3">
|
||
<div className={`flex size-9 shrink-0 items-center justify-center rounded-lg ${iconClassName}`}>
|
||
<Icon className="size-5" />
|
||
</div>
|
||
<div className="min-w-0">
|
||
<p className="text-muted-foreground text-sm">{label}</p>
|
||
<p className="text-2xl leading-tight font-semibold">{value}</p>
|
||
</div>
|
||
</div>
|
||
{hint && <p className="text-muted-foreground mt-2 text-xs">{hint}</p>}
|
||
{progress !== undefined && (
|
||
<div className="bg-muted mt-2 h-1.5 w-full overflow-hidden rounded-full">
|
||
<div
|
||
className={`h-full rounded-full ${progress >= 90 ? 'bg-destructive' : 'bg-primary'}`}
|
||
style={{ width: `${Math.min(100, progress)}%` }}
|
||
/>
|
||
</div>
|
||
)}
|
||
</>
|
||
);
|
||
|
||
if (href) {
|
||
return (
|
||
<Link href={href} className={`block rounded-lg border p-4 transition hover:brightness-95 dark:hover:brightness-110 ${accentClassName}`}>
|
||
{content}
|
||
</Link>
|
||
);
|
||
}
|
||
|
||
return <div className={`rounded-lg border p-4 ${accentClassName}`}>{content}</div>;
|
||
}
|