File
Blob: src/client/components/workspace/layout-mode.ts
| 1 | import { createContext, use } from "react"; |
| 2 | |
| 3 | export interface WorkspaceLayoutModeValue { |
| 4 | expanded: boolean; |
| 5 | } |
| 6 | |
| 7 | export const WorkspaceLayoutModeContext = createContext<WorkspaceLayoutModeValue | null>(null); |
| 8 | |
| 9 | export function useWorkspaceLayoutMode(): WorkspaceLayoutModeValue { |
| 10 | const value = use(WorkspaceLayoutModeContext); |
| 11 | if (!value) { |
| 12 | throw new Error("useWorkspaceLayoutMode must be used inside WorkspaceLayoutModeProvider"); |
| 13 | } |
| 14 | return value; |
| 15 | } |