19 lines
458 B
TypeScript
19 lines
458 B
TypeScript
/**
|
|
* Journal context — provides `onClose` to message renderers so that
|
|
* clicking a link message can close the panel on mobile.
|
|
*/
|
|
|
|
import { createContext, useContext } from "solid-js";
|
|
|
|
export interface JournalContextValue {
|
|
onClose: () => void;
|
|
}
|
|
|
|
const JournalContext = createContext<JournalContextValue>();
|
|
|
|
export function useJournalContext(): JournalContextValue | undefined {
|
|
return useContext(JournalContext);
|
|
}
|
|
|
|
export { JournalContext };
|