Skip to content
Snippets Groups Projects
Commit 8b654a27 authored by Liliana Sanfilippo's avatar Liliana Sanfilippo
Browse files

Engineering Sidebar fix

parent 0c4ee358
No related branches found
No related tags found
No related merge requests found
Pipeline #532683 passed
......@@ -9,9 +9,32 @@ export function EngSide(){
let nums = ["rep1", "rep2", "rep3", "rep4", "rep5", "rep6", "trf1", "trf2", "trf3", "trf4", "pe1", "pe2", "pe3", "peg1", "peg2", "peg3", "peg4", "peg5",
"nic1", "nic2", "nic3", "nic4", "nic5", "nic6","del1", "del2", "del3", "del4", "del5"]
useEffect(() => {
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
window.addEventListener("scroll", handleScroll);
return () => window.removeEventListener("scroll", handleScroll);
}, [nums]);
// Restore active tab on reload
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const tabId = params.get("tab");
const subTabId = params.get("subTab");
if (tabId) {
// Find the parent element and mark it as active
const parentTab = document.querySelector(`#parent-${tabId}`);
if (parentTab) {
document.querySelectorAll(".active-sideitem").forEach((el) => el.classList.remove("active-sideitem"));
parentTab.classList.add("active-sideitem");
}
// Optionally expand the subtab if available
if (subTabId) {
const subTab = document.querySelector(`#${subTabId}`);
if (subTab) {
subTab.classList.add("highlight-subitem"); // Add a custom class for highlighting subtabs if needed
}
}
}
}, []);
const handleScroll = () => {
for(let idx in nums){
/* console.log("We are looking at 'item' = " + nums[idx]) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment