403Webshell
Server IP : 172.67.158.161  /  Your IP : 18.226.34.78
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/modal.js
import { LabelControl } from './label';
import { useState, useRef, useEffect } from '@wordpress/element';
import { Popover } from '@wordpress/components';

export const ModalControl = (props) => {
	const { prop, children, label } = props;
	const { width } = prop;

	const [isModalVisible, setIsModalVisible] = useState(false);
	const modalRef = useRef(null);
	const modalIconRef = useRef(null);

	useEffect(() => {
		const handleDocumentClick = (e) => {

			// Access Modal Handler
			if (
				modalRef.current &&
				!modalRef.current.contains(e.target) &&
				modalIconRef.current &&
				!modalIconRef.current.contains(e.target)
			) {
				setIsModalVisible(false);
			}
		};

		document.addEventListener('click', handleDocumentClick);
		return () => {
			document.removeEventListener('click', handleDocumentClick);
		};
	}, []);
	
	var style = pagelayer_empty(width) ? {} : {width: width};
	
	return (
		<div className="components-base-control pagelayer-base-control">
			<LabelControl {...props} />
			<div className="pagelayer-elp-modal-div">
				<span
					className="pagelayer-elp-modal"
					onClick={() => setIsModalVisible(true)}
					ref={ modalIconRef }
				>
					<i className={`pli pli-window`}></i>
				</span>
				{isModalVisible && ( 
						<Popover className="pagelayer-elp-modal-wrapper" position="top-start">
							<div className="pagelayer-elp-modal-wrap" style={style} ref={ modalRef }>
								<div className="pagelayer-elp-modal-header">
									{ label }
									<i className="pagelayer-elp-modal-close pli pli-cross" aria-hidden="true" onClick={() => setIsModalVisible(false)}></i>
								</div>
								<hr />
								<div className="pagelayer-elp-modal-holder">
									{ children }
								</div>
							</div>
					</Popover>
				) }
			</div>
		</div>
	)
}

Youez - 2016 - github.com/yon3zu
LinuXploit