mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 08:25:07 +00:00
61 lines
1.1 KiB
TypeScript
61 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import {
|
|
Modal,
|
|
ModalOverlay,
|
|
ModalContent,
|
|
ModalHeader,
|
|
ModalCloseButton,
|
|
ModalContentProps,
|
|
Box
|
|
} from '@chakra-ui/react';
|
|
|
|
interface Props extends ModalContentProps {
|
|
title?: any;
|
|
isCentered?: boolean;
|
|
isOpen: boolean;
|
|
onClose?: () => void;
|
|
}
|
|
|
|
const MyModal = ({
|
|
isOpen,
|
|
onClose,
|
|
title,
|
|
children,
|
|
isCentered,
|
|
w = 'auto',
|
|
maxW = ['90vw', '600px'],
|
|
...props
|
|
}: Props) => {
|
|
return (
|
|
<Modal
|
|
isOpen={isOpen}
|
|
onClose={() => onClose && onClose()}
|
|
autoFocus={false}
|
|
isCentered={isCentered}
|
|
>
|
|
<ModalOverlay />
|
|
<ModalContent
|
|
w={w}
|
|
minW={['90vw', '400px']}
|
|
maxW={maxW}
|
|
position={'relative'}
|
|
maxH={'90vh'}
|
|
{...props}
|
|
>
|
|
{!!title && <ModalHeader>{title}</ModalHeader>}
|
|
{onClose && <ModalCloseButton />}
|
|
<Box
|
|
overflow={props.overflow || 'overlay'}
|
|
h={'100%'}
|
|
display={'flex'}
|
|
flexDirection={'column'}
|
|
>
|
|
{children}
|
|
</Box>
|
|
</ModalContent>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default MyModal;
|