From be6db4f18d1ea54ab0fdf2aabe0130e27362a9a9 Mon Sep 17 00:00:00 2001 From: jrangel Date: Wed, 11 Dec 2024 16:48:23 +0000 Subject: [PATCH] Remove unnecessary controls --- react/components/iconselectcontrol.js | 41 +++++---------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/react/components/iconselectcontrol.js b/react/components/iconselectcontrol.js index 143aa4d..144c801 100644 --- a/react/components/iconselectcontrol.js +++ b/react/components/iconselectcontrol.js @@ -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 ( <> - - - ({ - label: popup.title.rendered, - value: popup.id, - }))} - onChange={(value) => setAttributes({ popUpId: value })} - /> - setAttributes({ buttonText: value })} - /> + + + {/* Pass the icons array to the IconSelectControl component */} - - -
-
- {buttonText} -
-
+ + ); }