Skip to content

Commit

Permalink
2018 Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ArjunAranetaCodes committed Nov 20, 2018
1 parent 0999828 commit b44ae7b
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions mern-mongodb-login-reg/client/src/controls/TextFieldGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react'
import classnames from 'classnames'
import PropTypes from 'prop-types'

const TextFieldGroup = ({
name,
placeholder,
value,
label,
error,
info,
type,
onChange,
disabled
}) => {
return (
<div className="form-group">
<input
type={type}
className={classnames('form-control form-control-lg', {
'is-invalid': error
})}
placeholder={placeholder}
name={name}
value={value}
onChange={onChange}
disabled={disabled}
/>
{info && <small className="form-text text-muted">{info}</small>}
{error && <div className="invalid-feedback">{error}</div>}
</div>
)
}

TextFieldGroup.propTypes = {
name: PropTypes.string.isRequired,
placeholder: PropTypes.string,
value: PropTypes.string.isRequired,
info: PropTypes.string,
error: PropTypes.string,
type: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
disabled: PropTypes.string
}

TextFieldGroup.defaultProps = {
type: 'text'
}

export default TextFieldGroup

0 comments on commit b44ae7b

Please sign in to comment.