function menuMobile() {
  const menuPicto = document.querySelector('.ds-menu-picto');
  const topbar = document.querySelector('.ds-header');
  const header = document.querySelector('.ds-menu-header');
  const menu = document.querySelector('.ds-menu');

  if (!menuPicto) {
    return;
  }

  menu.style.top = `${topbar.clientHeight + header.clientHeight}px`;

  menuPicto.onclick = function (e) {
    e.preventDefault();

    if (window.matchMedia('(min-width: 1200px)').matches) {
      return;
    }

    const bodyPage = document.body;

    menu.style.top = `${topbar.clientHeight + header.clientHeight}px`;
    bodyPage.classList.toggle('open-ds-menu');
  };
}

export default menuMobile;
