const html = require('choo/html'); module.exports = function(state, emit) { if (!state.capabilities.account) { return null; } 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'); } function hideMenu(event) { event.stopPropagation(); const dropdown = document.querySelector('.account_dropdown'); dropdown.classList.remove('visible'); } };