import React from "react"; import { cn } from "@/lib/utils"; import { Slider } from "./slider"; /** * Right-sidebar organism for the Borrowing Capacity page. * * Shows the current interest rate used in the calculation along with the * resulting buying power and estimated repayments. The slider lets the user * explore how different rates affect their borrowing capacity. * * This is a **controlled** component — the consumer owns `rate` and * `onRateChange`; no internal state is held. */ export interface InterestRateUsedProps { /** Current interest rate (%) — drives the slider position */ rate: number; /** Called when the slider is moved */ onRateChange: (rate: number) => void; /** Pre-formatted buying power string, e.g. "$957.53K" */ buyingPowerFormatted: string; /** Pre-formatted repayments string, e.g. "$2.66K" */ repaymentsFormatted: string; /** Minimum rate (default: 0) */ minRate?: number; /** Maximum rate (default: 13) */ maxRate?: number; /** Slider step (default: 0.01) */ rateStep?: number; className?: string; } export function InterestRateUsed({ rate, onRateChange, buyingPowerFormatted, repaymentsFormatted, minRate = 0, maxRate = 13, rateStep = 0.01, className, }: InterestRateUsedProps) { return (
Interest Rate Used
Current Buying Power
{buyingPowerFormatted}
Repayments
{repaymentsFormatted}
{rate.toFixed(2)}%