Files
projectsend/resources/js/components/stat-tile.tsx
ignacionelson 6e47d76ba6 ProjectSend 2.0.0
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.
2026-08-14 01:38:12 -03:00

50 lines
1.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
/** 0100. 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>;
}