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