update cloudflare context
This commit is contained in:
27
packages/ui/src/components/currency.tsx
Normal file
27
packages/ui/src/components/currency.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
type CurrencyProps = {
|
||||
children: number
|
||||
options?: Intl.NumberFormatOptions
|
||||
locale?: string
|
||||
currency?: string
|
||||
}
|
||||
|
||||
export function Currency({
|
||||
children,
|
||||
options,
|
||||
locale = 'pt-BR',
|
||||
currency = 'BRL'
|
||||
}: CurrencyProps): ReactNode {
|
||||
const optionsInit: Intl.NumberFormatOptions = {
|
||||
style: 'currency',
|
||||
currency
|
||||
}
|
||||
|
||||
const formatter = new Intl.NumberFormat(locale, {
|
||||
...optionsInit,
|
||||
...options
|
||||
})
|
||||
|
||||
return formatter.format(children)
|
||||
}
|
||||
Reference in New Issue
Block a user