const html = require('choo/html'); module.exports = function(state, emit) { const user = state.user; const menu = user.loggedIn ? html` ` : html` `; return html`
${menu}
`; function avatarClick(event) { event.preventDefault(); const dropdown = document.querySelector('.account_dropdown'); dropdown.classList.toggle('visible'); dropdown.focus(); } function login(event) { event.preventDefault(); emit('login'); } function logout(event) { event.preventDefault(); emit('logout'); } //the onblur trick makes links unclickable wtf /* function hideMenu(event) { event.stopPropagation(); const dropdown = document.querySelector('.account_dropdown'); dropdown.classList.remove('visible'); } */ };