Add error to inputs

This commit is contained in:
Maxime Lalo 2024-07-19 16:52:51 +02:00
parent 1dc2738ee0
commit 1d414049a8
2 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import BaseField, { IProps as IBaseFieldProps } from "../BaseField";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import classnames from "classnames"; import classnames from "classnames";
import Image from "next/image"; import Image from "next/image";
import { XMarkIcon } from "@heroicons/react/24/outline";
export type IProps = IBaseFieldProps & { export type IProps = IBaseFieldProps & {
canCopy?: boolean; canCopy?: boolean;
password?: boolean; password?: boolean;
@ -40,11 +40,16 @@ export default class TextField extends BaseField<IProps> {
disabled={this.props.disabled} disabled={this.props.disabled}
type={this.props.password ? "password" : "text"} type={this.props.password ? "password" : "text"}
/> />
{this.props.canCopy && ( {this.props.canCopy && !this.hasError() && (
<div className={classes["copy-icon"]} onClick={this.onCopyClick}> <div className={classes["copy-icon"]} onClick={this.onCopyClick}>
<Image src={CopyIcon} alt="Copy icon" /> <Image src={CopyIcon} alt="Copy icon" />
</div> </div>
)} )}
{this.hasError() && (
<div className={classes["cross-icon"]} onClick={this.onCopyClick}>
<XMarkIcon height="24px" width="24px" color="var(--input-error)" />
</div>
)}
</div> </div>
</label> </label>
{this.hasError() && <div className={classes["errors-container"]}>{this.renderErrors()}</div>} {this.hasError() && <div className={classes["errors-container"]}>{this.renderErrors()}</div>}

View File

@ -3,7 +3,6 @@ import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors"; import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors";
import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation"; import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation";
import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField";
import Confirm from "@Front/Components/DesignSystem/OldModal/Confirm"; import Confirm from "@Front/Components/DesignSystem/OldModal/Confirm";
import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar"; import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar";
import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography";
@ -22,6 +21,7 @@ import classes from "./classes.module.scss";
import ClientSection from "./ClientSection"; import ClientSection from "./ClientSection";
import Loader from "@Front/Components/DesignSystem/Loader"; import Loader from "@Front/Components/DesignSystem/Loader";
import Newsletter from "@Front/Components/DesignSystem/Newsletter"; import Newsletter from "@Front/Components/DesignSystem/Newsletter";
import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField";
export enum AnchorStatus { export enum AnchorStatus {
"VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN", "VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN",