import React from "react"; import { cn } from "@/lib/utils"; /** * Section header block used above each chart on the Money (Transactions) page. * * Two layout variants: * * `layout="vertical"` (default) * ┌─────────────────────────────────────────┐ * │ $37,085 [optional action] │ * │ Cash Balance │ * │ 30 Days Total │ * │ (Based on connected bank transactions) │ * └─────────────────────────────────────────┘ * * `layout="horizontal"` * ┌─────────────────────────────────────────┐ * │ CASH BALANCE $37,085 │ * │ (Based on connected bank transactions) │ * └─────────────────────────────────────────┘ */ export interface TransactionsSummaryBlockProps { /** Pre-formatted total value — e.g. "$37,085" — displayed prominently */ value: string; /** Section label — e.g. "Cash Balance", "Income", "Expense" */ label: string; /** Period text — e.g. "30 Days Total" (vertical layout only) */ period?: string; /** Small footnote — e.g. "(Based on connected bank transactions)" */ footnote?: string; /** Optional trailing element — e.g. a Button for "Set Goal" (vertical layout only) */ action?: React.ReactNode; /** * Layout variant. * - `"vertical"` (default): value large on top, label + period below * - `"horizontal"`: label small-caps left, value large right — mirrors Borrowing Capacity style */ layout?: "vertical" | "horizontal"; className?: string; } export function TransactionsSummaryBlock({ value, label, period, footnote, action, layout = "vertical", className, }: TransactionsSummaryBlockProps) { if (layout === "horizontal") { return (

{label}

{value}

{action &&
{action}
}
{footnote && (

{footnote}

)}
); } return (

{value}

{label}

{period &&

{period}

} {footnote && (

{footnote}

)}
{action &&
{action}
}
); }