import React, { FC } from 'react'; import Modal from '../ui/Modal'; import cx from 'classnames'; export interface ContentPreviewModalProps { open: boolean; onClose: () => void; title?: string; /** When true, renders image with min 600px width; otherwise renders children in snippet-style area */ isImage?: boolean; imageSrc?: string; imageAlt?: string; /** Content for non-image preview (text, Snippet, iframe, etc.) */ children?: React.ReactNode; className?: string; } const ContentPreviewModal: FC = ({ open, onClose, title, isImage = false, imageSrc, imageAlt = '', children, className, }) => { const width = 'min(90vw, 800px)'; return ( onClose()} width={width} widthMd={width} className={cx('memori-content-preview-modal', className, { 'memori-content-preview-modal--image': isImage, })} closable title={title} footer={null} >
{isImage && imageSrc ? (
{imageAlt}
) : (
{children}
)}
); }; export default ContentPreviewModal;