feat(journal): add JournalContext to allow closing panel on mobile
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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 };
|
||||
Reference in New Issue
Block a user