import React, { useState, useEffect } from 'react'; import { faFolder } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import StyledWrapper from './StyledWrapper'; import Modal from 'components//Modal'; const SaveRequest = ({items, onClose}) => { const [showFolders, setShowFolders] = useState([]); useEffect(() => { setShowFolders(items || []); }, [items]) const handleFolderClick = (folder) => { let subFolders = []; if(folder.items && folder.items.length) { for (let item of folder.items) { if (item.items) { subFolders.push(item) } } if(subFolders.length) { setShowFolders(subFolders); } } } return (

Select a folder to save request:

{showFolders && showFolders.length ? showFolders.map((folder) => (
handleFolderClick(folder)} > {folder.name}
)): null}
); }; export default SaveRequest;