Skip to content

Commit

Permalink
Set mdc-drawer hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
j-a-n committed Apr 10, 2023
1 parent 5aa1ff8 commit 2a37991
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion wallpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,23 @@ function getCurrentView() {

function setSidebarHidden(hidden) {
try {
elHaMain.shadowRoot.querySelector("ha-sidebar").style.visibility = (hidden ? "hidden" : "visible");
let drawer = elHaMain.shadowRoot.querySelector("ha-drawer");
if (drawer) {
drawer = drawer.shadowRoot.querySelector(".mdc-drawer");
}
if (hidden) {
elHaMain.style.setProperty("--app-drawer-width", 0);
elHaMain.style.setProperty("--mdc-drawer-width", 0);
if (drawer) {
drawer.style.setProperty("display", "none");
}
}
else {
elHaMain.style.removeProperty("--app-drawer-width");
elHaMain.style.removeProperty("--mdc-drawer-width");
if (drawer) {
drawer.style.removeProperty("display");
}
}
window.dispatchEvent(new Event('resize'));
}
Expand Down

0 comments on commit 2a37991

Please sign in to comment.