'init'
This commit is contained in:
16
app/providers/DialogStateProvider.tsx/useDialogPin.ts
Normal file
16
app/providers/DialogStateProvider.tsx/useDialogPin.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useContext } from "react";
|
||||
import { DialogStateContext } from "./DialogStateProvider";
|
||||
|
||||
export function useDialogPin(dialog_id: string){
|
||||
const context = useContext(DialogStateContext);
|
||||
if(!context){
|
||||
throw new Error("useDialogState must be used within a DialogStateProvider");
|
||||
}
|
||||
|
||||
const isPinned = context.pinned.includes(dialog_id);
|
||||
|
||||
return {
|
||||
isPinned,
|
||||
pinToggle: context.pinToggle
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user