Skip to content

High performance self-hosted photo and video management solution.

540 B
Raw Blame
import { mediaQueryManager } from '#lib/stores/media-query-manager.svelte.ts';

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 || !this.isOpen;
  }
}

export const sidebarStore = new SidebarStore();