This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
// Recursive Component to render the tree structure with collapsible and auto-expand functionality on search | |
const TreeNode = ({ node, isExpandedInitially, onItemClick }) => { | |
const [isExpanded, setIsExpanded] = useState(isExpandedInitially); | |
// Update the expand state when the initial expand prop changes (e.g., during search) | |
useEffect(() => { | |
setIsExpanded(isExpandedInitially); | |
}, [isExpandedInitially]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
// Recursive component to render tree nodes | |
const RenderTree = ({ node }) => { | |
const [isOpen, setIsOpen] = useState(true); | |
const toggle = () => setIsOpen(!isOpen); | |
return ( | |
<div style={{ marginLeft: '20px' }}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Styles import here | |
import "../Styles/Pages/Home.css"; | |
//Styles import here | |
//Components import here | |
// import Navbar from '../Components/Navbar'; | |
import CatalogAccordion from "../Components/Sidebar.jsx"; | |
//Components import here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package march06; | |
public class Employee { | |
public int id; | |
public String name; | |
public String positon; | |
public Employee(int id, String name, String positon) { | |
this.id = id; | |
this.name = name; |