react-simple-modal-controller
Version:
simple and convenient modal-controller for react
25 lines (24 loc) • 733 B
TypeScript
/// <reference types="react" />
import { ModalInfo, ModalResolver } from "../types/modal";
export type ModalReducerAction<V = unknown> = {
type: "OPEN";
id: ModalInfo["id"];
Component: ModalInfo["Component"];
props: ModalInfo["props"];
} | {
type: "OPEN_ASYNC";
id: ModalInfo["id"];
Component: ModalInfo["Component"];
props: ModalInfo["props"];
resolver: ModalResolver<V>;
} | {
type: "CLOSE";
} | {
type: "CLEAR";
};
export declare const modalReducer: <V>(state: ModalInfo[], action: ModalReducerAction<V>) => (ModalInfo<unknown> | {
id: string;
Component: import("react").ComponentType<any>;
props: Record<string, unknown> | undefined;
resolve: (value: V) => void;
})[];