Update sidebar controller to handle right panel width dynamically

- Add conditional width class for right sidebar panel
- Ensure consistent sidebar toggle behavior for both left and right panels
- Use specific width class for right panel (w-[375px])
This commit is contained in:
Josh Pigford
2025-02-27 17:19:07 -05:00
parent fbe90b79a0
commit c0a3ff86a2

View File

@@ -16,10 +16,18 @@ export default class extends Controller {
const panel = side === "left" ? this.leftPanelTarget : this.rightPanelTarget;
// Toggle the sidebar visibility
panel.classList.toggle("w-0");
panel.classList.toggle("opacity-0");
panel.classList.toggle("w-80");
panel.classList.toggle("opacity-100");
if (side === "left") {
panel.classList.toggle("w-0");
panel.classList.toggle("opacity-0");
panel.classList.toggle("w-80");
panel.classList.toggle("opacity-100");
} else {
// For right panel, use the correct width class
panel.classList.toggle("w-0");
panel.classList.toggle("opacity-0");
panel.classList.toggle("w-[375px]");
panel.classList.toggle("opacity-100");
}
// Determine sidebar states
const leftSidebarOpen = !this.leftPanelTarget.classList.contains("w-0");