Hide sidebar by default on mobile devices
This commit is contained in:
committed by
Aditya Chandel
parent
e4fe1ab029
commit
db5e840aec
+9
-3
@@ -16,6 +16,9 @@ export class SidebarFilterTogglePrefService {
|
|||||||
readonly showFilter$ = this.showFilterSubject.asObservable();
|
readonly showFilter$ = this.showFilterSubject.asObservable();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
const isNarrow = window.innerWidth <= 768;
|
||||||
|
this.showFilterSubject = new BehaviorSubject<boolean>(!isNarrow);
|
||||||
|
this.showFilter$ = this.showFilterSubject.asObservable();
|
||||||
this.loadFromStorage();
|
this.loadFromStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,9 +51,12 @@ export class SidebarFilterTogglePrefService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadFromStorage(): void {
|
private loadFromStorage(): void {
|
||||||
const saved = this.localStorageService.get<boolean>(this.STORAGE_KEY);
|
const isNarrow = window.innerWidth <= 768;
|
||||||
if (saved !== null) {
|
if (isNarrow) {
|
||||||
this.showFilterSubject.next(saved);
|
this.showFilterSubject.next(false);
|
||||||
|
} else {
|
||||||
|
const saved = this.localStorageService.get<boolean>(this.STORAGE_KEY);
|
||||||
|
this.showFilterSubject.next(saved !== null ? saved : true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user