Skip to content

Commit

Permalink
allow decimals in fiat input
Browse files Browse the repository at this point in the history
  • Loading branch information
jonator committed Jul 8, 2024
1 parent b6e41e1 commit b1d8a06
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/web/components/bridge/crypto-fiat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const CryptoFiatInput: FunctionComponent<{
if (nextValue.startsWith("0") && !nextValue.startsWith("0.")) {
nextValue = nextValue.slice(1);
}

if (nextValue === "") {
nextValue = "0";
}
Expand Down Expand Up @@ -149,10 +148,14 @@ export const CryptoFiatInput: FunctionComponent<{
}
}, [asset, isMax, onInput]);

const fiatCurrentValue = `${assetPrice.symbol}${new IntPretty(fiatInputRaw)
.locale(false)
.trim(true)
.maxDecimals(assetPrice.fiatCurrency.maxDecimals)}`;
const fiatCurrentValue = `${assetPrice.symbol}${
fiatInputRaw.endsWith(".")
? fiatInputRaw
: new IntPretty(fiatInputRaw)
.locale(false)
.trim(true)
.maxDecimals(assetPrice.fiatCurrency.maxDecimals)
}`;
const fiatInputFontSize = calcTextSizeClass(
fiatCurrentValue.length,
isMobile
Expand Down

0 comments on commit b1d8a06

Please sign in to comment.