import React, { useRef, useState } from "react"; import { AddIcon, ArrowIcon, RemoveIcon, ResizeHeightIcon, } from "../../../icons/ExportCommonIcons"; import RenameInput from "../../../ui/inputs/RenameInput"; import { handleResize } from "../../../../functions/handleResizePannel"; interface Path { pathName: string; // Represents the name of the path Children: string[]; // Represents the list of child points } interface DropListProps { val: Path; // Use the Path interface for the val prop } const DropList: React.FC = ({ val }) => { const [openDrop, setOpenDrop] = useState(false); return (
{ setOpenDrop(!openDrop); }} > {val.pathName}
{val.Children && openDrop && (
{val.Children.map((child, index) => (
{child}
))}
)}
); }; const Simulations: React.FC = () => { const productsContainerRef = useRef(null); const [productsList, setProductsList] = useState([]); const [selectedItem, setSelectedItem] = useState(); const handleAddAction = () => { setProductsList([...productsList, `Product ${productsList.length + 1}`]); }; const handleRemoveAction = (index: number) => { setProductsList(productsList.filter((_, i) => i !== index)); if (selectedItem === productsList[index]) { setSelectedItem(""); } }; const Value = [ { pathName: "Path 1", Children: ["Point 1", "Point 2"] }, { pathName: "Path 2", Children: ["Point 1", "Point 2"] }, { pathName: "Path 3", Children: ["Point 1", "Point 2"] }, ]; return (
Simulations
Products
Add
{productsList.map((action, index) => (
setSelectedItem(action)} >
handleRemoveAction(index)} >
))}
handleResize(e, productsContainerRef)} >
Operations
{Value.map((val, index) => ( ))}
Need to Compare Layout?
Click 'Compare' to review and analyze the layout differences between them.
); }; export default Simulations;