import React, { Component } from "react"
import PropTypes from "prop-types"
class FormInput extends Component {
constructor(props) {
super(props)
this.isNotRequiredAndEmpty = this.isNotRequiredAndEmpty.bind(this)
}
isNotRequiredAndEmpty = () => !this.props.inputValue && !this.props.isRequired
render() {
return (
{this.props.bigTextBox ?
:
}
{!this.props.isValid && !this.isNotRequiredAndEmpty() && this.props.validationMessage &&
{this.props.validationMessage}
}
)
}
}
FormInput.propTypes = {
isValid: PropTypes.bool,
placeholderText: PropTypes.string,
validationMessage: PropTypes.string,
inputValue: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
isRequired: PropTypes.bool,
bigTextBox: PropTypes.bool
}
export default FormInput