add a back to porfolio link to folder tree component
This commit is contained in:
parent
ba483eb27d
commit
90bddfde70
@ -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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user