import { noop } from "@greatness/util";
import { createContext } from "react";

export interface IConfirmContextState {
  show: boolean;
  text: string | null;
}

interface IConfirmContextActions {
  closeConfirm: () => void;
  showConfirm: (text: string) => void;
}

const ConfirmContext = createContext<
  [IConfirmContextState, IConfirmContextActions]
>([
  {
    show: false,
    text: null,
  },
  { closeConfirm: noop, showConfirm: noop },
]);

export default ConfirmContext;
