Remove unnecessary controls
This commit is contained in:
@ -11,21 +11,12 @@ export default function Edit(props) {
|
||||
const [popups, setPopups] = useState([]);
|
||||
const [icons, setIcons] = useState([]); // To hold the icon data
|
||||
|
||||
// Fetch published popups (lcp-popup CPT)
|
||||
useEffect(() => {
|
||||
const fetchPopups = async () => {
|
||||
const response = await fetch('/wp-json/wp/v2/lcp-popup');
|
||||
const data = await response.json();
|
||||
setPopups(data);
|
||||
};
|
||||
fetchPopups();
|
||||
}, []);
|
||||
|
||||
// Fetch icon data from the JSON source (local or remote)
|
||||
// Fetch icon data from the JSON source
|
||||
useEffect(() => {
|
||||
const fetchIcons = async () => {
|
||||
// Assuming the icon data is in a file called 'icons.json'
|
||||
const response = await fetch('/path/to/icons.json');
|
||||
const response = await fetch('/iconsvgs.json');
|
||||
const iconData = await response.json();
|
||||
setIcons(iconData); // Set the fetched icon data
|
||||
};
|
||||
@ -46,22 +37,9 @@ export default function Edit(props) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
<PanelBody title={__("Popup Settings")}>
|
||||
<SelectControl
|
||||
label={__("Popup")}
|
||||
value={popUpId}
|
||||
options={popups.map((popup) => ({
|
||||
label: popup.title.rendered,
|
||||
value: popup.id,
|
||||
}))}
|
||||
onChange={(value) => setAttributes({ popUpId: value })}
|
||||
/>
|
||||
<TextControl
|
||||
label={__("Button Text")}
|
||||
value={buttonText}
|
||||
onChange={(value) => setAttributes({ buttonText: value })}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
{/* Pass the icons array to the IconSelectControl component */}
|
||||
<IconSelectControl
|
||||
label={__("Icon")}
|
||||
@ -69,13 +47,8 @@ export default function Edit(props) {
|
||||
onChange={handleIconChange}
|
||||
icons={icons} // Passing the icons data here
|
||||
/>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
<div {...useBlockProps()}>
|
||||
<div className="button-container">
|
||||
<span>{buttonText}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user