Files
spacedrive/interface/app/$libraryId/Layout/Sidebar/SidebarLayout/Context.tsx
nikec 407f99248b [ENG-578] Resizable sidebar (#2425)
* v1

* Update pnpm-lock.yaml

* Update store.ts

* Update index.tsx

* fix animation

* toggle_sidebar

* locales
2024-05-01 14:35:09 +00:00

19 lines
437 B
TypeScript

import { createContext, useContext } from 'react';
interface SidebarContextProps {
show: boolean;
locked: boolean;
collapsed: boolean;
onLockedChange: (val: boolean) => void;
}
export const SidebarContext = createContext<SidebarContextProps | null>(null);
export const useSidebarContext = () => {
const ctx = useContext(SidebarContext);
if (ctx === null) throw new Error('SidebarContext.Provider not found!');
return ctx;
};