Spaces:
Paused
Paused
File size: 533 Bytes
ab2ded1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import { useState } from 'react';
export interface IModalManagerChildrenProps {
showModal(): void;
hideModal(): void;
visible: boolean;
}
interface IProps {
children: (props: IModalManagerChildrenProps) => React.ReactNode;
}
const ModalManager = ({ children }: IProps) => {
const [visible, setVisible] = useState(false);
const showModal = () => {
setVisible(true);
};
const hideModal = () => {
setVisible(false);
};
return children({ visible, showModal, hideModal });
};
export default ModalManager;
|