Skip to content

Commit a3b2cf6

Browse files
committed
fix: use formatCurrencyAmount
1 parent 727171c commit a3b2cf6

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
spacing,
1313
} from "../../../../core/design-system/index.js";
1414
import { useBuyWithFiatQuotesForProviders } from "../../../../core/hooks/pay/useBuyWithFiatQuotesForProviders.js";
15+
import { formatCurrencyAmount } from "../../ConnectWallet/screens/formatTokenBalance.js";
1516
import { Container } from "../../components/basic.js";
1617
import { Button } from "../../components/buttons.js";
1718
import { Img } from "../../components/Img.js";
@@ -164,12 +165,10 @@ export function FiatProviderSelection({
164165
size="sm"
165166
style={{ fontWeight: 500 }}
166167
>
167-
{new Intl.NumberFormat(navigator.language, {
168-
style: "currency",
169-
currency: currency,
170-
minimumFractionDigits: 2,
171-
maximumFractionDigits: 2,
172-
}).format(quote.currencyAmount)}
168+
{formatCurrencyAmount(
169+
currency || "US",
170+
quote.currencyAmount,
171+
)}
173172
</Text>
174173
<Text color="secondaryText" size="xs">
175174
{formatNumber(

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
55
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
66
import { radius, spacing } from "../../../../core/design-system/index.js";
77
import type { PaymentMethod } from "../../../../core/machines/paymentMachine.js";
8-
import { formatTokenAmount } from "../../ConnectWallet/screens/formatTokenBalance.js";
8+
import {
9+
formatCurrencyAmount,
10+
formatTokenAmount,
11+
} from "../../ConnectWallet/screens/formatTokenBalance.js";
912
import { Container } from "../../components/basic.js";
1013
import { Button } from "../../components/buttons.js";
1114
import { Skeleton } from "../../components/Skeleton.js";
@@ -90,12 +93,8 @@ function PaymentMethodTokenRow({
9093
size="sm"
9194
style={{ fontWeight: 600, textWrap: "nowrap" }}
9295
>
93-
{new Intl.NumberFormat(navigator.language, {
94-
style: "currency",
95-
currency: currency,
96-
minimumFractionDigits: 2,
97-
maximumFractionDigits: 2,
98-
}).format(
96+
{formatCurrencyAmount(
97+
currency || "USD",
9998
Number(
10099
formatTokenAmount(
101100
paymentMethod.balance,

0 commit comments

Comments
 (0)