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
Contributor

Em đã thực hiện bóc tách phần Sidebar cũ ra thành một component riêng biệt để dễ quản lý và tái sử dụng, nhờ anh Quân review code giúp em nhé!

Em đã thực hiện bóc tách phần Sidebar cũ ra thành một component riêng biệt để dễ quản lý và tái sử dụng, nhờ anh Quân review code giúp em nhé!
hiepht added 1 commit 2026-06-04 02:19:36 +00:00
hiepht force-pushed dev-hiepht-old from 8a2b4be7ac to 3c4385777c 2026-06-04 02:24:37 +00:00 Compare
hiepht added 1 commit 2026-06-04 02:26:50 +00:00
hiepht added 1 commit 2026-06-04 02:29:49 +00:00
hiepht added 1 commit 2026-06-04 02:34:28 +00:00
hiepht added 1 commit 2026-06-05 13:55:28 +00:00
- Replace hardcoded inline sidebar markup with <div id="sidebar-container">
  on: aboutMain, newsMain, productMain, serviceMain, contactMain
- Add sidebar-container + sidebarLoader.js script to pages that had no
  sidebar at all: newsArticle1, newsArticle2, productSeparateCommerceLNG,
  productSeparateCommercePNG, productSeparateProductionPRU,
  productSeparateProductionGasMeter, productSeparateProductionVaporizer,
  productSeparateProductionPressureRegulatorValve
- Sidebar HTML/CSS/JS is now loaded dynamically from /components/sidebar/
  on all 14 pages (mobile breakpoint ≤768px)"
hiepht added 1 commit 2026-06-05 14:06:15 +00:00
- sidebar.css: change .floating-menu-btn breakpoint from max-width:768px
  to max-width:992px so the button appears on tablets as well
- header.css: move .nav-container hide + .floating-menu-btn show into
  the ≤992px block so desktop nav is hidden and sidebar activates on
  all mobile + tablet viewports (Bootstrap lg breakpoint)
- ≥993px (desktop): header nav visible, sidebar hidden
- ≤992px (tablet + mobile): header nav hidden, sidebar floating button shown"
hiepht added 1 commit 2026-06-05 14:08:28 +00:00
hiepht added 1 commit 2026-06-05 14:27:10 +00:00
Lỗi: sidebar.js dùng DOMContentLoaded nhưng script được load động sau khi
sự kiện này đã kích hoạt → initSidebar() không bao giờ chạy → nút menu
không có event listener → click không phản hồi.

Sửa: gọi initSidebar() trực tiếp thay vì bọc trong DOMContentLoaded.
MinhQuan merged commit 0974a1987b into main 2026-06-06 17:50:30 +00:00
MinhQuan deleted branch dev-hiepht-old 2026-06-06 17:50:30 +00:00
Owner

sidebar: turn into component

sidebar: turn into component
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MinhQuan/PresentCorpo#4