mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-31 00:40:46 +02:00
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>
29 lines
733 B
TypeScript
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>
|
|
);
|
|
}
|