forked from Alex/Pterodactyl-Panel
c28cba92e2
This allows entire components to be unmounted when the modal is hidden without affecting the fade in/out of the modal itself. This also makes it easier to programatically dismiss a modal without having to copy the visibility all over the place, and makes working with props much simpler in those modal components
16 lines
339 B
TypeScript
16 lines
339 B
TypeScript
import React from 'react';
|
|
|
|
export interface ModalContextValues {
|
|
dismiss: () => void;
|
|
toggleSpinner: (visible?: boolean) => void;
|
|
}
|
|
|
|
const ModalContext = React.createContext<ModalContextValues>({
|
|
dismiss: () => null,
|
|
toggleSpinner: () => null,
|
|
});
|
|
|
|
ModalContext.displayName = 'ModalContext';
|
|
|
|
export default ModalContext;
|