diff --git a/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/InputValidationMessage.tsx b/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/InputValidationMessage.tsx index 71d51c96..38ef41a5 100644 --- a/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/InputValidationMessage.tsx +++ b/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/InputValidationMessage.tsx @@ -1,4 +1,4 @@ -import { Box, useBreakpointValue, useColorMode, useTheme } from '@bnb-chain/space'; +import { Box, useColorMode, useTheme } from '@bnb-chain/space'; import { useEffect, useState } from 'react'; import { useAccount } from 'wagmi'; @@ -13,7 +13,6 @@ export const InputValidationMessage = () => { const { validateInput } = useInputValidation(); const { chain } = useAccount(); const dispatch = useAppDispatch(); - const isBase = useBreakpointValue({ base: true, lg: false }) ?? false; const transferActionInfo = useAppSelector((state) => state.transfer.transferActionInfo); const theme = useTheme(); @@ -67,11 +66,10 @@ export const InputValidationMessage = () => { return error || balanceInputError ? ( {balanceInputError ?? error?.text} diff --git a/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/index.tsx b/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/index.tsx index 7bf09445..fcfa5c04 100644 --- a/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/index.tsx +++ b/packages/canonical-bridge-widget/src/modules/transfer/components/SendInput/index.tsx @@ -1,5 +1,5 @@ import { Box, Flex, Input, useColorMode, useDisclosure, useIntl, useTheme } from '@bnb-chain/space'; -import { useRef } from 'react'; +import { useRef, useState } from 'react'; import { useAppDispatch, useAppSelector } from '@/modules/store/StoreProvider'; import { setSendValue } from '@/modules/transfer/action'; @@ -40,9 +40,11 @@ export const SendInput: React.FC = () => { const dispatch = useAppDispatch(); const { formatMessage } = useIntl(); const timerRef = useRef(); + const theme = useTheme(); + + const [isFocused, setIsFocused] = useState(false); const sendValue = useAppSelector((state) => state.transfer.sendValue); - const theme = useTheme(); const selectedToken = useAppSelector((state) => state.transfer.selectedToken); const isGlobalFeeLoading = useAppSelector((state) => state.transfer.isGlobalFeeLoading); const fromChain = useAppSelector((state) => state.transfer.fromChain); @@ -100,13 +102,38 @@ export const SendInput: React.FC = () => { p={'12px 16px'} h={'64px'} borderRadius={'8px'} - border={`1px solid ${ + border={'1px solid'} + borderColor={`${ !!error?.text ? theme.colors[colorMode].text.danger + : isFocused + ? theme.colors[colorMode].text.brand : theme.colors[colorMode].input.border.default }`} + boxShadow={ + !!error?.text + ? `0 0 0 1px ${theme.colors[colorMode].text.danger}` + : isFocused + ? `0 0 0 1px ${theme.colors[colorMode].text.brand}` + : 'none' + } background={theme.colors[colorMode].input.background} position={'relative'} + _hover={{ + outline: '1px solid', + outlineColor: !!error?.text + ? theme.colors[colorMode].text.danger + : isFocused + ? theme.colors[colorMode].text.brand + : theme.colors[colorMode].input.border.hover, + border: `1px solid ${ + !!error?.text + ? theme.colors[colorMode].text.danger + : isFocused + ? theme.colors[colorMode].text.brand + : theme.colors[colorMode].input.border.hover + }`, + }} > { fontSize={'24px'} onChange={onChangeSendValue} placeholder={'0.0'} + onFocus={() => { + setIsFocused(true); + }} + onBlur={() => { + setIsFocused(false); + }} border={'none'} disabled={!selectedToken || (isGlobalFeeLoading && sendValue === debouncedSendValue)} _hover={{ diff --git a/packages/canonical-bridge-widget/src/modules/transfer/components/ToAccount/index.tsx b/packages/canonical-bridge-widget/src/modules/transfer/components/ToAccount/index.tsx index 24615031..d35c00c5 100644 --- a/packages/canonical-bridge-widget/src/modules/transfer/components/ToAccount/index.tsx +++ b/packages/canonical-bridge-widget/src/modules/transfer/components/ToAccount/index.tsx @@ -3,7 +3,7 @@ import { Box, Input, useColorMode, - theme, + useTheme, FlexProps, useIntl, InputGroup, @@ -25,6 +25,7 @@ export function ToAccount(props: FlexProps) { const { colorMode } = useColorMode(); const { formatMessage } = useIntl(); const dispatch = useAppDispatch(); + const theme = useTheme(); const [isChecked, setIsChecked] = useState(false); @@ -86,24 +87,34 @@ export function ToAccount(props: FlexProps) { {...props} > {formatMessage({ id: 'to.section.account.label' })} - + {isInvalid && ( - + {formatMessage({ id: 'to.section.account.invalid' })} )}