import React from "react"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import { ReactNode } from "react"; import CopyIcon from "@Assets/Icons/copy.svg"; import BaseField, { IProps as IBaseFieldProps } from "../BaseField"; import classes from "./classes.module.scss"; import classnames from "classnames"; import Image from "next/image"; export type IProps = IBaseFieldProps & { canCopy?: boolean; password?: boolean; }; export default class TextField extends BaseField { constructor(props: IProps) { super(props); this.state = this.getDefaultState(); } public override render(): ReactNode { const value = this.state.value ?? ""; return (
{this.props.placeholder} {!this.props.required && " (Facultatif)"}
{this.props.canCopy && (
Copy icon
)}
{this.hasError() &&
{this.renderErrors()}
}
); } private onCopyClick = (): void => { if (this.props.canCopy) { navigator.clipboard.writeText(this.state.value ?? ""); } }; }