{"size": 636, "ext": "js", "max_stars_repo_path": "assets/_js/header-search.js", "max_stars_repo_name": "CSIS-iLab/health-commission", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "assets/_js/header-search.js", "max_issues_repo_name": "CSIS-iLab/health-commission", "max_issues_repo_issues_event_min_datetime": "2018-09-10T17:33:55.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-30T16:06:55.000Z", "max_forks_repo_path": "assets/_js/header-search.js", "max_forks_repo_name": "CSIS-iLab/health-commission", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 78, "max_forks_count": null, "avg_line_length": 30.2857142857, "max_line_length": 70, "alphanum_fraction": 0.6965408805}
const headerSearch = () => {
  const searchBtn = document.querySelector('.btn--search')
  const searchBar = document.querySelector('.site-header__search-bar')
  const searchClose = document.querySelector('.btn--search-close')
  const searchInput = searchBar.querySelector('input')
  const triggers = [searchBtn, searchClose]

  triggers.forEach(element => {
    element.addEventListener('click', function() {
      searchBtn.classList.toggle('is-active')
      searchBar.classList.toggle('is-active')

      if (searchBar.classList.contains('is-active')) {
        searchInput.focus()
      }
    })
  })
}

export default headerSearch
