Refactor: Extract sidebar into a reusable component #4

Merged
MinhQuan merged 8 commits from hiepht/PresentCorpo:dev-hiepht-old into main 2026-06-06 17:50:30 +00:00
Showing only changes of commit 870755b570 - Show all commits
+7 -3
View File
@@ -1,7 +1,8 @@
// views/components/sidebar/sidebar.js
document.addEventListener("DOMContentLoaded", () => {
initSidebar();
});
// NOTE: This script is always loaded dynamically by sidebarLoader.js AFTER
// the sidebar HTML has already been injected into #sidebar-container.
// DOMContentLoaded has already fired at this point, so we must call
// initSidebar() directly — NOT inside a DOMContentLoaded listener.
function initSidebar() {
const floatingMenuBtn = document.getElementById("floatingMenuBtn");
@@ -67,3 +68,6 @@ function initSidebar() {
lastScrollY = window.scrollY;
});
}
// Call directly — sidebar HTML is already in DOM when this script executes
initSidebar();