export const bindEvents = () => { document.querySelectorAll('a[data-click]').forEach((e) => { e.addEventListener('click', (evt) => { evt.preventDefault(); const dialog = document.querySelector('dialog.'+e.getAttribute('data-click')); document.querySelector('#menu-toggle').checked = false; dialog?.classList.remove('hidden'); dialog?.showModal(); dialog?.addEventListener('click', (evt) => { if (evt.target === dialog) { dialog?.close(); dialog?.classList.add('hidden'); } }); }); }); };