{"size": 933, "ext": "js", "max_stars_repo_path": "src/react/src/Components/Forms/Atoms/Input.js", "max_stars_repo_name": "gravitationalwavedc/gwlab-viterbi-cw", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/react/src/Components/Forms/Atoms/Input.js", "max_issues_repo_name": "gravitationalwavedc/gwlab-viterbi-cw", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/react/src/Components/Forms/Atoms/Input.js", "max_forks_repo_name": "gravitationalwavedc/gwlab-viterbi-cw", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.1, "max_line_length": 72, "alphanum_fraction": 0.5101822079}
import React from 'react';
import { Form, InputGroup } from 'react-bootstrap';

const Input = ({formik, title, name, type, units, helpText, ...rest}) =>
    <Form.Group controlId={ name }>
        <Form.Label>{ title }</Form.Label>
        <InputGroup>
            <Form.Control 
                name={ name }
                type={ type } 
                isValid={formik.touched[name] && !formik.errors[name]}
                isInvalid={!!formik.errors[name]}
                {...formik.getFieldProps(name)} 
                {...rest} />
            {units && 
            <InputGroup.Prepend>
                <InputGroup.Text>{units}</InputGroup.Text>
            </InputGroup.Prepend>}
        </InputGroup>
        <Form.Text>
            {helpText}
        </Form.Text>
        <Form.Control.Feedback type='invalid'>
            {formik.errors[name]}
        </Form.Control.Feedback>
    </Form.Group>;


export default Input;
