import React, {InputHTMLAttributes, LegacyRef, ReactNode} from "react"; import styles from "./Input.module.scss"; import {Info} from "react-feather" interface Props extends InputHTMLAttributes { id?: string; label?: string; toolTip?: string; error?: string; fullWidth?: boolean; icon?: ReactNode; } export default React.forwardRef(({label, error, fullWidth, icon, toolTip, ...props}: Props, forwardRef: LegacyRef) => { if (label && !props.id) { throw new Error("Props id is required when label is define"); } if (toolTip && !label) { throw new Error("Props label is required when labelInfo is define"); } return (
{label &&
}
{icon}
{error &&
{error}
}
); });