import React from 'react';


const InputText = ({labelTitle, containerStyle, inputType, placeholder, onBlurFun, onChange, name, errorMessage, inputStyle, labelStyle, handleFocus, value, errorMessageAbove, searchButtonStyle, searchButtonIcon, required, maxlength}) => {

  
  return (
    <div className={containerStyle}>
        <label htmlFor={name} className={labelStyle}>{labelTitle}</label>{errorMessageAbove ? <span className='error-mes'>{errorMessage}</span> : ''}
        {searchButtonIcon ? <button className={searchButtonStyle} >{searchButtonIcon}</button> : ''}
        <input type={inputType} className={inputStyle} name={name} placeholder={placeholder} onBlur={onBlurFun} onFocus={handleFocus} onChange={onChange} value={value} required={required} maxlength={maxlength}/>
        {!errorMessageAbove ? <p className="error-mes">{errorMessage}</p> : ''}
    </div>
  )
}

export default InputText
