mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-13 06:31:47 +00:00
* fix(frontend): keep collapsed sidebar navigation visible on mobile * fix(frontend): address mobile sidebar review feedback * fix(ci): keep frontend agent guidance within size budget * fix(frontend): align mobile sidebar focus and trigger state * fix(frontend): keep Agents header actions within mobile viewport --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { PanelLeftCloseIcon, PanelLeftOpenIcon } from "lucide-react";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { useSidebar } from "@/components/ui/sidebar";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export function WorkspaceSidebarTrigger({
|
|
className,
|
|
onClick,
|
|
...props
|
|
}: React.ComponentProps<typeof Button>) {
|
|
const { isMobile, open, openMobile, toggleSidebar } = useSidebar();
|
|
const expanded = isMobile ? openMobile : open;
|
|
|
|
return (
|
|
<Button
|
|
type="button"
|
|
data-sidebar="trigger"
|
|
data-slot="sidebar-trigger"
|
|
variant="ghost"
|
|
size="icon"
|
|
className={cn("size-7 opacity-50 hover:opacity-100", className)}
|
|
{...props}
|
|
aria-expanded={expanded}
|
|
aria-haspopup={isMobile ? "dialog" : undefined}
|
|
onClick={(event) => {
|
|
onClick?.(event);
|
|
if (event.defaultPrevented) return;
|
|
// Touch browsers need an explicit focus target for drawer dismissal.
|
|
if (isMobile && !openMobile) event.currentTarget.focus();
|
|
toggleSidebar();
|
|
}}
|
|
>
|
|
{expanded ? <PanelLeftCloseIcon /> : <PanelLeftOpenIcon />}
|
|
<span className="sr-only">Toggle Sidebar</span>
|
|
</Button>
|
|
);
|
|
}
|