14 lines
543 B
TypeScript
14 lines
543 B
TypeScript
import { createContext, useContext } from "react";
|
|
|
|
export type ReadingDocument = { id: string; title: string; host: HTMLDivElement };
|
|
export type ReadingWorkspace = {
|
|
active: ReadingDocument | null;
|
|
view: "focus" | "map_split" | "map_only";
|
|
open: (document: ReadingDocument) => void;
|
|
close: (id?: string) => void;
|
|
setView: (view: ReadingWorkspace["view"]) => void;
|
|
};
|
|
export const ReadingWorkspaceContext = createContext<ReadingWorkspace | null>(null);
|
|
|
|
export const useReadingWorkspace = () => useContext(ReadingWorkspaceContext);
|