import React from 'react'; import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalContentProps, Box, Image, useMediaQuery } from '@chakra-ui/react'; import MyIcon from '../Icon'; export interface MyModalProps extends ModalContentProps { iconSrc?: string; title?: any; isCentered?: boolean; isOpen: boolean; onClose?: () => void; } const MyModal = ({ isOpen, onClose, iconSrc, title, children, isCentered, w = 'auto', maxW = ['90vw', '600px'], ...props }: MyModalProps) => { const [isPc] = useMediaQuery('(min-width: 900px)'); return ( onClose && onClose()} autoFocus={false} isCentered={isPc ? isCentered : true} > {!title && onClose && } {!!title && ( {iconSrc && ( <> {iconSrc.startsWith('/') ? ( ) : ( )} )} {title} {onClose && ( )} )} {children} ); }; export default React.memo(MyModal);