A little bit more styling and default expanded Side bar

This commit is contained in:
Tuan Cao 2022-03-24 15:19:01 +07:00
parent c56bacc34b
commit bf58dd15c6

View File

@ -15,11 +15,13 @@ export default function FolderTree(props) {
); );
const router = useRouter() const router = useRouter()
// const childrenNodeIds = props.tree.children.map(aNode => {return aNode.id})
const expandedNodes = [props.tree.id]
return ( return (
<TreeView <TreeView
aria-label="rich object" aria-label="rich object"
defaultCollapseIcon={<ExpandMoreIcon />} defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpanded={['root']} defaultExpanded={expandedNodes}
defaultExpandIcon={<ChevronRightIcon />} defaultExpandIcon={<ChevronRightIcon />}
onNodeSelect = {(event, nodIds) => { onNodeSelect = {(event, nodIds) => {
const currentNode = props.flattenNodes.find(aNode => {return aNode.id === nodIds}) const currentNode = props.flattenNodes.find(aNode => {return aNode.id === nodIds})