"use client"; import { cn } from "@/lib/utils"; import { TrendingUp, TrendingDown, Minus } from "lucide-react"; import { formatPrice, formatPercent } from "@/lib/mock/cryptoMockData"; interface PriceDisplayProps { price: number; priceChange?: number; size?: "sm" | "md" | "lg"; showIcon?: boolean; className?: string; } const sizeClasses = { sm: { price: "text-sm font-medium", change: "text-xs" }, md: { price: "text-lg font-semibold", change: "text-sm" }, lg: { price: "text-2xl font-bold", change: "text-base" }, }; export function PriceDisplay({ price, priceChange, size = "md", showIcon = true, className, }: PriceDisplayProps) { const isPositive = priceChange !== undefined && priceChange > 0; const isNegative = priceChange !== undefined && priceChange < 0; const isNeutral = priceChange === undefined || priceChange === 0; return (
{formatPrice(price)} {priceChange !== undefined && ( {showIcon && ( <> {isPositive && } {isNegative && } {isNeutral && } )} {formatPercent(priceChange)} )}
); }