add a back to porfolio link to folder tree component

This commit is contained in:
Triston Armstrong 2023-12-25 19:27:55 -06:00
parent ba483eb27d
commit 90bddfde70

View File

@ -4,6 +4,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import { useRouter } from 'next/router'
import { styled } from '@mui/material/styles';
import { Divider } from '@mui/material';
const TCTreeItem = styled(TreeItem)(({ theme }) => ({
'& .MuiTreeItem-content': {
@ -30,22 +31,26 @@ export default function FolderTree(props) {
// const childrenNodeIds = props.tree.children.map(aNode => {return aNode.id})
const expandedNodes = [props.tree.id]
return (
<TreeView
aria-label="rich object"
defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpanded={expandedNodes}
defaultExpandIcon={<ChevronRightIcon />}
onNodeSelect={(event, nodIds) => {
const currentNode = props.flattenNodes.find(aNode => {
return aNode.id === nodIds
})
if (currentNode != null && currentNode.routePath != null) {
router.push(currentNode.routePath)
}
}}
sx={{ flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
>
{renderTree(props.tree)}
</TreeView>
<>
<a href='http://localhost:3000'>{"<-"} Back To Portfolio</a>
<Divider />
<TreeView
aria-label="rich object"
defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpanded={expandedNodes}
defaultExpandIcon={<ChevronRightIcon />}
onNodeSelect={(event, nodIds) => {
const currentNode = props.flattenNodes.find(aNode => {
return aNode.id === nodIds
})
if (currentNode != null && currentNode.routePath != null) {
router.push(currentNode.routePath)
}
}}
sx={{ flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
>
{renderTree(props.tree)}
</TreeView>
</>
);
}