import React, { FC, HTMLAttributes, ReactNode } from 'react'; export interface InputContainerProps extends HTMLAttributes { wrapperClass: string; activeClass: string; extraLabelClass: string; validationTextClass: string; label: string | ReactNode | undefined; validationText: string | undefined; id: string | undefined; infoId: string | undefined; infoText: string | undefined; /** Indica che il componente ha un bottone a destra rispetto all'input */ hasButtonRight?: boolean; /** Componente per il bottone */ buttonRight?: ReactNode; /** Indica che il componente ha una icona a sinistra rispetto all'input */ hasIconLeft?: boolean; /** Componente per l'icona */ iconLeft?: ReactNode; testId?: string; } export const InputContainer: FC = ({ id, infoId, infoText, testId, activeClass, extraLabelClass, label, validationTextClass, validationText, wrapperClass, hasButtonRight, buttonRight, hasIconLeft, iconLeft, children }) => { if (hasButtonRight || hasIconLeft) { return (
{hasIconLeft && {iconLeft}} {children} {infoText && ( {infoText} )}
{validationText}
{hasButtonRight &&
{buttonRight}
}
); } return (
{children} {infoText && ( {infoText} )}
{validationText}
); };