Files
legolog/client/public/components/notificationbar.mjs
Benjamin Kyd 4a83c84d3d something
Former-commit-id: 41811c2d7d98c1d3ad65e0d1dd559de64f96845e
2022-03-25 15:57:12 +00:00

29 lines
991 B
JavaScript

import { RegisterComponent, Component, SideLoad } from './components.mjs';
class NotificationBar extends Component {
static __IDENTIFY() { return 'notificationbar'; }
constructor() {
super(NotificationBar);
}
Render() {
return {
template: SideLoad('./components/templates/notificationbar.html'),
style: SideLoad('./components/css/notificationbar.css'),
};
}
OnceRendered() {
// expect only one notification bar on the dom (otherwise this won't work)
const notificationToggler = document.querySelector('notificationbar-component').shadowRoot.querySelector('.notification-toggler');
const notificationBar = document.querySelector('notificationbar-component').shadowRoot.querySelector('.notification-bar');
notificationToggler.addEventListener('click', () => {
notificationBar.classList.add('notification-toggled');
});
}
}
RegisterComponent(NotificationBar);