/var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components
Edit: /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/box-shadow.js (5836B)
import { __ } from '@wordpress/i18n';
import { LabelControl } from './label';
import { useState, useRef, useEffect } from '@wordpress/element';
import { ColorPicker } from '@wordpress/components';
// TODO: re-arrang the content
export const BoxShadowControl = (props) =>{
const { prop, value, setAttributes } = props;
const { name } = prop['c'];
var values = !pagelayer_empty(value) ? value : ['','','','','',''];
// Do we have a val ?
if(pagelayer_is_string(values)){
values = values.split(',');
}
const [isColorPickerVisible, setIsColorPickerVisible] = useState(false);
const [isBoxShadowVisible, setBoxShadowVisible] = useState(false);
const colorPreviewRef = useRef(null);
const colorPickerRef = useRef(null);
const boxShadowRef = useRef(null);
const handleInputChange = (index, newValue) => {
const newValues = [...values];
newValues[index] = newValue;
setAttributes({ [name]: newValues});
};
const onChange = (color = '') => {
handleInputChange(3, color);
}
const handleRemoveColor = (e) => {
handleInputChange(3, '');
setIsColorPickerVisible(false);
};
useEffect(() => {
const handleDocumentClick = (e) => {
// ColorPicker Handler
if (
colorPickerRef.current &&
!colorPickerRef.current.contains(e.target) &&
colorPreviewRef.current &&
!colorPreviewRef.current.contains(e.target)
) {
setIsColorPickerVisible(false);
}
// Shodow Modal Handler
if(
boxShadowRef.current &&
!boxShadowRef.current.contains(e.target)
){
setBoxShadowVisible(false);
}
};
document.addEventListener('click', handleDocumentClick);
return () => {
document.removeEventListener('click', handleDocumentClick);
};
}, []);
var blank = 'pagelayer-blank-preview';
return (
setBoxShadowVisible(!isBoxShadowVisible)}
>
{ isBoxShadowVisible &&
}
);
}