Files
ragflow/web/src/components/modal-manager.tsx
balibabu eb381963b3 feat: confirm before deleting knowledge base and add ChunkToolBar (#56)
* feat: confirm before deleting knowledge base

* feat: add ChunkToolBar
2024-02-05 19:26:03 +08:00

26 lines
533 B
TypeScript

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;