MCPcopy Create free account
hub / github.com/PostHog/duckgres / StatCard

Function StatCard

controlplane/admin/ui/src/components/StatCard.tsx:5–39  ·  view source on GitHub ↗
({
  label,
  value,
  hint,
  icon,
  accent,
  children,
}: {
  label: string;
  value: ReactNode;
  hint?: ReactNode;
  icon?: ReactNode;
  accent?: "default" | "success" | "warning" | "destructive";
  children?: ReactNode;
})

Source from the content-addressed store, hash-verified

3import { Card } from "@/components/ui/card";
4
5export function StatCard({
6 label,
7 value,
8 hint,
9 icon,
10 accent,
11 children,
12}: {
13 label: string;
14 value: ReactNode;
15 hint?: ReactNode;
16 icon?: ReactNode;
17 accent?: "default" | "success" | "warning" | "destructive";
18 children?: ReactNode;
19}) {
20 const accentColor =
21 accent === "success"
22 ? "text-success"
23 : accent === "warning"
24 ? "text-warning"
25 : accent === "destructive"
26 ? "text-destructive"
27 : "text-foreground";
28 return (
29 <Card className="p-4" data-testid={`stat-${label}`}>
30 <div className="flex items-start justify-between">
31 <p className="text-xs font-medium uppercase tracking-wide text-muted-foreground">{label}</p>
32 {icon && <span className="text-muted-foreground">{icon}</span>}
33 </div>
34 <div className={cn("mt-2 text-2xl font-semibold tabular-nums", accentColor)}>{value}</div>
35 {hint && <p className="mt-1 text-xs text-muted-foreground">{hint}</p>}
36 {children && <div className="mt-3">{children}</div>}
37 </Card>
38 );
39}

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected