add isError to input
This commit is contained in:
parent
fdccd42121
commit
71a186fda9
2 changed files with 11 additions and 2 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ const WalletSend = () => {
|
|||
placeholder="Amount to transfer"
|
||||
label="Amount:"
|
||||
inputData={amount}
|
||||
isError={amount.value > 1000}
|
||||
/>
|
||||
<MyInput
|
||||
placeholder="Enter the comment"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue