mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
20 lines
588 B
TypeScript
20 lines
588 B
TypeScript
import { createContext, useContext } from "react";
|
|
|
|
const SidebarCollapsedContext = createContext(false);
|
|
|
|
/**
|
|
* Provider that reports whether the main sidebar is currently collapsed,
|
|
* taking into account both user preference and whether the current layout
|
|
* allows the sidebar to collapse.
|
|
*/
|
|
export const SidebarCollapsedProvider = SidebarCollapsedContext.Provider;
|
|
|
|
/**
|
|
* Returns whether the main sidebar is currently collapsed.
|
|
*
|
|
* @returns true if the sidebar is collapsed.
|
|
*/
|
|
export function useSidebarCollapsed(): boolean {
|
|
return useContext(SidebarCollapsedContext);
|
|
}
|