Files
multica/packages/views/layout/page-header.tsx
Jiayuan 2f08097289 feat(views): add left sidebar collapse option for desktop
Show a sidebar toggle button in the page header when the sidebar is
collapsed on desktop, and add a toggle button to the sidebar footer
for collapsing. Also adds Cmd+B / Ctrl+B keyboard shortcut to toggle
the sidebar.

Closes #1967

Co-authored-by: multica-agent <github@multica.ai>
2026-05-01 09:18:31 +02:00

29 lines
733 B
TypeScript

"use client";
import { cn } from "@multica/ui/lib/utils";
import { SidebarTrigger, useSidebar } from "@multica/ui/components/ui/sidebar";
function SidebarToggle() {
try {
const { state } = useSidebar();
// On mobile: always show (hamburger). On desktop: only when sidebar is collapsed.
return <SidebarTrigger className={cn("mr-2", state === "expanded" && "md:hidden")} />;
} catch {
return null;
}
}
interface PageHeaderProps {
children: React.ReactNode;
className?: string;
}
export function PageHeader({ children, className }: PageHeaderProps) {
return (
<div className={cn("flex h-12 shrink-0 items-center border-b px-4", className)}>
<SidebarToggle />
{children}
</div>
);
}