diff --git a/src/components/StatTile.tsx b/src/components/StatTile.tsx index 0c52abf..7d97c9f 100644 --- a/src/components/StatTile.tsx +++ b/src/components/StatTile.tsx @@ -1,15 +1,29 @@ -import { type ReactNode } from "react"; - -type Props = { - label: ReactNode; - value: ReactNode; -}; - -export function StatTile({ label, value }: Props) { - return ( -
-
{label}
-
{value}
-
- ); -} +import { type ReactNode } from "react"; + +type Props = { + label: ReactNode; + value: ReactNode; + /** Optional signed delta shown beside the value (e.g. +12%). */ + trend?: ReactNode; + trendDirection?: "up" | "down" | "neutral"; +}; + +const trendClass: Record, string> = { + up: "text-emerald-600 dark:text-emerald-400", + down: "text-rose-600 dark:text-rose-400", + neutral: "text-neutral-500", +}; + +export function StatTile({ label, value, trend, trendDirection = "neutral" }: Props) { + return ( +
+
{label}
+
+ {value} + {trend !== undefined && ( + {trend} + )} +
+
+ ); +}