{"size": 715, "ext": "js", "max_stars_repo_path": "src/components/Search/SearchForm.js", "max_stars_repo_name": "antaradatta3/telemedicine-web", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/Search/SearchForm.js", "max_issues_repo_name": "antaradatta3/telemedicine-web", "max_issues_repo_issues_event_min_datetime": "2020-02-19T07:30:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T10:27:57.000Z", "max_forks_repo_path": "src/components/Search/SearchForm.js", "max_forks_repo_name": "antaradatta3/telemedicine-web", "max_forks_repo_forks_event_min_datetime": "2020-04-17T12:32:45.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-17T12:32:45.000Z"}
{"max_stars_count": null, "max_issues_count": 186, "max_forks_count": 1, "avg_line_length": 19.8611111111, "max_line_length": 79, "alphanum_fraction": 0.5972027972}
import React, { useState } from 'react';
import PropTypes from 'prop-types';

export const SearchForm = ({ search }) => {
  const [thread, setThread] = useState('');

  const searchThread = () => {
    search(thread);
  };

  const updateThread = e => {
    setThread(e.target.value);
  };

  return (
    <div className="form-inline">
      <input
        type="text"
        className="form-control"
        onChange={updateThread}
        value={thread}
        placeholder="Search Thread"
      />
      <button type="button" className="btn btn-primary" onClick={searchThread}>
        Search
      </button>
    </div>
  );
};

SearchForm.propTypes = {
  search: PropTypes.func,
};

export default SearchForm;
