react-hook-modal
Version:
A custom modal, with a custom hook for modal handling in React App
33 lines (32 loc) • 1.12 kB
TypeScript
import React from 'react';
import { ModalState } from './Modal.context';
export interface ModalProps {
classContainer?: any;
styles?: {
container?: React.CSSProperties;
header?: React.CSSProperties;
body?: React.CSSProperties;
footer?: React.CSSProperties;
};
}
export declare function Modal({ classContainer, styles }: ModalProps): JSX.Element;
export interface ModalOptions {
title?: string;
dataProps?: any;
width?: string | number;
height?: string | number;
closeOnBackgroundOrEsc?: boolean | undefined;
resizable?: boolean;
fullScreen?: boolean;
animation?: boolean;
footer?: JSX.Element | null | undefined;
darkMode?: boolean;
}
export declare const useModal: (closeCb?: Function | undefined) => {
dataToProps: any;
modalState: ModalState;
setComponentToRender: (element: JSX.Element, options?: ModalOptions | undefined) => void;
closeModal: (data?: any) => void;
setOptions: (options?: ModalOptions | undefined) => void;
setFooter: (footer: JSX.Element | null) => void;
};