mirror of
https://github.com/immich-app/immich.git
synced 2026-04-28 03:50:37 -04:00
22 lines
559 B
TypeScript
22 lines
559 B
TypeScript
import { mediaQueryManager } from '$lib/stores/media-query-manager.svelte';
|
|
|
|
class SidebarStore {
|
|
isOpen = $derived.by(() => mediaQueryManager.isFullSidebar);
|
|
|
|
/**
|
|
* Reset the sidebar visibility to the default, based on the current screen width.
|
|
*/
|
|
reset() {
|
|
this.isOpen = mediaQueryManager.isFullSidebar;
|
|
}
|
|
|
|
/**
|
|
* Toggles the sidebar visibility, if available at the current screen width.
|
|
*/
|
|
toggle() {
|
|
this.isOpen = mediaQueryManager.isFullSidebar ? true : !this.isOpen;
|
|
}
|
|
}
|
|
|
|
export const sidebarStore = new SidebarStore();
|