add isError to input

This commit is contained in:
Alex 2023-08-28 12:53:00 +02:00
parent fdccd42121
commit 71a186fda9
2 changed files with 11 additions and 2 deletions

View file

@ -5,7 +5,15 @@ import { classNames } from "../../../utils/classNames";
const MyInput = memo((props) => {
const id = nextId();
const { label, inputData, isValid, noActiveBorder, type, ...otherProps } = props;
const {
label,
inputData,
isValid,
noActiveBorder,
type,
isError,
...otherProps
} = props;
const { value, onChange, onInput, inputValid, onBlur, isDirty, isFilled } =
inputData;
@ -37,7 +45,7 @@ const MyInput = memo((props) => {
value={value}
className={classNames("", {
[cls.filled]: isFilled && !noActiveBorder,
[cls.error]: isDirty && !inputValid,
[cls.error]: (isDirty && !inputValid) || isError,
[cls.customError]: isDirty && isValid === false && inputValid
})}
{...otherProps}

View file

@ -128,6 +128,7 @@ const WalletSend = () => {
placeholder="Amount to transfer"
label="Amount:"
inputData={amount}
isError={amount.value > 1000}
/>
<MyInput
placeholder="Enter the comment"