From 186b74f849c7020e4f799a341cb431a88056038a Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Wed, 8 May 2024 14:10:12 +0800 Subject: [PATCH] Update font size of BalanceInput --- src/components/balance-input.tsx | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/components/balance-input.tsx b/src/components/balance-input.tsx index 9c4ea7e..f611b6d 100644 --- a/src/components/balance-input.tsx +++ b/src/components/balance-input.tsx @@ -2,7 +2,7 @@ import { Asset, Cross } from "@/types"; import Input from "@/ui/input"; import { BN, BN_ZERO, bnToBn } from "@polkadot/util"; import AssetSelect from "./asset-select"; -import { ChangeEventHandler, useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { ChangeEventHandler, useCallback, useEffect, useMemo, useRef } from "react"; import { formatBalance } from "@/utils"; import { formatUnits, parseUnits } from "viem"; import { InputAlert } from "./input-alert"; @@ -43,7 +43,6 @@ export default function BalanceInput({ const assetRef = useRef(asset); const spanRef = useRef(null); const inputRef = useRef(null); - const [dynamicStyle, setDynamicStyle] = useState(""); const _placeholder = useMemo(() => { if (balance && asset) { @@ -80,25 +79,6 @@ export default function BalanceInput({ assetRef.current = asset; }, [value, asset, min, balance, assetLimit, assetSupply, onChange]); - useEffect(() => { - const inputWidth = inputRef.current?.clientWidth || 1; - const spanWidth = spanRef.current?.clientWidth || 0; - const percent = (spanWidth / inputWidth) * 100; - if (percent < 20) { - setDynamicStyle("text-[2.25rem] font-light"); - } else if (percent < 30) { - setDynamicStyle("text-[1.875rem] font-light"); - } else if (percent < 40) { - setDynamicStyle("text-[1.5rem] font-normal"); - } else if (percent < 50) { - setDynamicStyle("text-[1.25rem] font-normal"); - } else if (percent < 60) { - setDynamicStyle("text-[1.125rem] font-medium"); - } else { - setDynamicStyle("text-[1rem] font-medium"); - } - }, [value]); - const insufficient = balance && value?.input && balance.lt(value.amount) ? true : false; const requireMin = min && value?.input && value.amount.lt(min) ? true : false; const requireLimit = isExcess(assetLimit, assetSupply, value?.amount); @@ -112,9 +92,7 @@ export default function BalanceInput({