fix(ui): Simplify sidebar initialization logic
Replace redundant conditional blocks with single if-else statement and move resize listener outside viewport check. Changes width threshold from `>` to `>=` for consistency with standard breakpoint behavior. Fixes #22930
This commit is contained in:
parent
58ac88bc51
commit
b6cc7d811f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -76,22 +76,17 @@ class SideNav {
|
||||||
toggler.addEventListener('click', event => this.onMobileToggle(event));
|
toggler.addEventListener('click', event => this.onMobileToggle(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.innerWidth > 1200) {
|
if (window.innerWidth >= 1200) {
|
||||||
if (this.state.get('pinned')) {
|
if (this.state.get('pinned')) {
|
||||||
this.pin();
|
this.pin();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (!this.state.get('pinned')) {
|
|
||||||
this.unpin();
|
this.unpin();
|
||||||
}
|
}
|
||||||
window.addEventListener('resize', () => this.onResize());
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
if (window.innerWidth < 1200) {
|
|
||||||
this.bodyRemove('hide');
|
this.bodyRemove('hide');
|
||||||
this.bodyAdd('hidden');
|
this.bodyAdd('hidden');
|
||||||
window.addEventListener('resize', () => this.onResize());
|
|
||||||
}
|
}
|
||||||
|
window.addEventListener('resize', () => this.onResize());
|
||||||
|
|
||||||
this.base.addEventListener('mouseenter', () => this.onEnter());
|
this.base.addEventListener('mouseenter', () => this.onEnter());
|
||||||
this.base.addEventListener('mouseleave', () => this.onLeave());
|
this.base.addEventListener('mouseleave', () => this.onLeave());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue