All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.sxp_blueprint_admin.js.shared.PreviewModal.js Maven / Gradle / Ivy

The newest version!
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayButton from '@clayui/button';
import ClayIcon from '@clayui/icon';
import ClayLink from '@clayui/link';
import ClayModal, {useModal} from '@clayui/modal';
import React, {useState} from 'react';

import {COPY_BUTTON_CSS_CLASS} from '../utils/constants';
import {openSuccessToast} from '../utils/toasts';
import CodeMirrorEditor from './CodeMirrorEditor';

const PreviewModal = ({body, children, size = 'md', title}) => {
	const [visible, setVisible] = useState(false);
	const {observer} = useModal({
		onClose: () => setVisible(false),
	});

	return (
		<>
			{visible && (
				
					{title}

					{body}
				
			)}

			
setVisible(!visible)}>{children}
); }; export function PreviewModalWithCopyDownload({ children, fileName, foldInitializationDelay, folded = false, lineWrapping, readOnly = true, size, text, title, type = 'application/json', }) { return ( {Liferay.Language.get('copy-to-clipboard')} { openSuccessToast({ message: Liferay.Language.get('downloaded'), }); }} outline > {Liferay.Language.get('download')} } size={size} title={title} > {children} ); } export default PreviewModal;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy