mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-28 04:02:18 +01:00
fix(ui): let closed sidebar suppress collapsed rail
This commit is contained in:
1 parent
ee9d48a3cd
commit
1bfc4051c6
2 files changed
+19
-2
No files matched your search
@@ -147,6 +147,23 @@ describe("SidebarShell", () => {
|
||||
expect(handle()).toBeNull();
|
||||
});
|
||||
|
||||
it("hides all sidebar width when closed, even if pinned collapsed", () => {
|
||||
window.localStorage.setItem("test.sidebar.width", "320");
|
||||
|
||||
act(() => {
|
||||
root.render(
|
||||
<SidebarShell open={false} collapsed resizable storageKey="test.sidebar.width">
|
||||
<div>Sidebar</div>
|
||||
</SidebarShell>,
|
||||
);
|
||||
});
|
||||
|
||||
expect(spacer().style.width).toBe("0px");
|
||||
expect(panel().style.width).toBe("0px");
|
||||
expect(panel().getAttribute("data-sidebar-overlay")).toBeNull();
|
||||
expect(handle()).toBeNull();
|
||||
});
|
||||
|
||||
it("overlays content while peeking without expanding the reserved spacer", () => {
|
||||
window.localStorage.setItem("test.sidebar.width", "300");
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ export function SidebarShell({
|
||||
|
||||
// Unified width function (plan §5): one code path for every pinned state.
|
||||
const expandedWidth = open ? width : 0;
|
||||
const reservedWidth = collapsed ? SIDEBAR_RAIL_WIDTH : expandedWidth;
|
||||
const panelWidth = collapsed && !peeking ? SIDEBAR_RAIL_WIDTH : expandedWidth;
|
||||
const reservedWidth = !open ? 0 : collapsed ? SIDEBAR_RAIL_WIDTH : expandedWidth;
|
||||
const panelWidth = !open ? 0 : collapsed && !peeking ? SIDEBAR_RAIL_WIDTH : expandedWidth;
|
||||
const isOverlay = panelWidth > reservedWidth;
|
||||
|
||||
// The drag handle can only resize the expanded width, so it is disabled while
|
||||
|
||||
Reference in new issue
Block a user