web: expand sidebar by default on desktop, auto collapse

This commit is contained in:
Jens Langhammer 2020-12-20 19:26:30 +01:00
parent 6a835ad192
commit 4d88dcff08
1 changed files with 4 additions and 0 deletions

View File

@ -18,6 +18,10 @@ export abstract class Interface extends LitElement {
constructor() { constructor() {
super(); super();
this.sidebarOpen = window.outerWidth >= 1280;
window.addEventListener("resize", () => {
this.sidebarOpen = window.outerWidth >= 1280;
});
window.addEventListener("ak-sidebar-toggle", () => { window.addEventListener("ak-sidebar-toggle", () => {
this.sidebarOpen = !this.sidebarOpen; this.sidebarOpen = !this.sidebarOpen;
}); });