mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
26 lines
533 B
TypeScript
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;
|