38 lines
759 B
TypeScript
38 lines
759 B
TypeScript
"use client";
|
|
|
|
import { formatPrice, formatPriceWithTc } from "@/lib/currency-utils";
|
|
import { cn } from "@/lib/utils";
|
|
import type { Currency } from "@/types/currency";
|
|
|
|
interface PriceDisplayProps {
|
|
value: number;
|
|
currency?: Currency;
|
|
showTc?: boolean;
|
|
className?: string;
|
|
size?: "sm" | "md" | "lg";
|
|
}
|
|
|
|
export function PriceDisplay({
|
|
value,
|
|
currency = "gp",
|
|
showTc = false,
|
|
className,
|
|
size = "md",
|
|
}: PriceDisplayProps) {
|
|
const sizeClasses = {
|
|
sm: "text-sm",
|
|
md: "text-lg",
|
|
lg: "text-2xl",
|
|
};
|
|
|
|
const formattedPrice = showTc
|
|
? formatPriceWithTc(value)
|
|
: formatPrice(value, currency);
|
|
|
|
return (
|
|
<span className={cn("font-bold", sizeClasses[size], className)}>
|
|
🪙 {formattedPrice}
|
|
</span>
|
|
);
|
|
}
|