paperclip/ui/src/components/MetricCard.tsx
Forgotten ad19bc921d feat(ui): onboarding wizard, comment thread, markdown editor, and UX polish
Refactor onboarding wizard with ASCII art animation and expanded adapter
support. Enhance markdown editor with code block, table, and CodeMirror
plugins. Improve comment thread layout. Add activity charts to agent
detail page. Polish metric cards, issue detail reassignment, and new
issue dialog. Simplify agent detail page structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:33:48 -06:00

53 lines
1.5 KiB
TypeScript

import type { LucideIcon } from "lucide-react";
import type { ReactNode } from "react";
import { Link } from "react-router-dom";
interface MetricCardProps {
icon: LucideIcon;
value: string | number;
label: string;
description?: ReactNode;
to?: string;
onClick?: () => void;
}
export function MetricCard({ icon: Icon, value, label, description, to, onClick }: MetricCardProps) {
const isClickable = !!(to || onClick);
const inner = (
<div className={`h-full px-4 py-4 sm:px-5 sm:py-5 rounded-lg transition-colors${isClickable ? " hover:bg-accent/50 cursor-pointer" : ""}`}>
<div className="flex items-start justify-between gap-3">
<div className="flex-1 min-w-0">
<p className="text-2xl sm:text-3xl font-semibold tracking-tight">
{value}
</p>
<p className="text-xs sm:text-sm font-medium text-muted-foreground mt-1">
{label}
</p>
{description && (
<div className="text-xs text-muted-foreground/70 mt-1.5 hidden sm:block">{description}</div>
)}
</div>
<Icon className="h-4 w-4 text-muted-foreground/50 shrink-0 mt-1.5" />
</div>
</div>
);
if (to) {
return (
<Link to={to} className="no-underline text-inherit h-full" onClick={onClick}>
{inner}
</Link>
);
}
if (onClick) {
return (
<div className="h-full" onClick={onClick}>
{inner}
</div>
);
}
return inner;
}