function submit (e) {
  e.preventDefault();
  $(e.currentTarget).parent().submit();
}

function openSearchBar (e) {
  e.preventDefault();
  const $target = $(e.currentTarget);
  $('.search').toggleClass('expanded', !$target.hasClass('expanded'));
}

function closeSearchBar (e) {
  const $target = $(e.currentTarget);
  const isExpanded = $target.hasClass('expanded');
  $('.search').toggleClass('expanded', isExpanded);
  $target.toggleClass('active', !isExpanded);
}

const init = $(() => {
  $('#btn-search').on('click', openSearchBar);
  $('#btn-search-close').on('click', closeSearchBar);
  $('#btn-search-submit').on('click', submit);
});

export {
  init as default
};

function submit (e) {
  e.preventDefault();
  $(e.currentTarget).parent().submit();
}

function openSearchBar (e) {
  e.preventDefault();
  const $target = $(e.currentTarget);
  $('.search').toggleClass('expanded', !$target.hasClass('expanded'));
}

function closeSearchBar (e) {
  const $target = $(e.currentTarget);
  const isExpanded = $target.hasClass('expanded');
  $('.search').toggleClass('expanded', isExpanded);
  $target.toggleClass('active', !isExpanded);
}

// -----

$('#btn-search').on('click', openSearchBar);
$('#btn-search-close').on('click', closeSearchBar);
$('#btn-search-submit').on('click', submit);

Refactor code to match ES6 style
Refactor code to match ES6 style
