mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 14:06:59 +00:00
24 lines
555 B
TypeScript
24 lines
555 B
TypeScript
const Price = ({
|
|
amount,
|
|
className,
|
|
currencyCode = 'SEK',
|
|
currencyCodeClassName
|
|
}: {
|
|
amount: string;
|
|
className?: string;
|
|
currencyCode: string;
|
|
currencyCodeClassName?: string;
|
|
} & React.ComponentProps<'p'>) => (
|
|
<p suppressHydrationWarning={true} className={className}>
|
|
{`${new Intl.NumberFormat('sv-SE', {
|
|
style: 'currency',
|
|
currency: currencyCode,
|
|
currencyDisplay: 'narrowSymbol',
|
|
minimumFractionDigits: 0,
|
|
maximumFractionDigits: 0
|
|
}).format(parseFloat(amount))}`}
|
|
</p>
|
|
);
|
|
|
|
export default Price;
|