feat(workspace): add WorkspaceLayout with resizable panels

This commit is contained in:
cfngc4594 2025-03-08 18:00:13 +08:00
parent 70626d0499
commit 0644a9f71f

View File

@ -0,0 +1,39 @@
import { WorkspaceHeader } from "@/components/workspace-header";
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
interface WorkspaceLayoutProps {
problem: React.ReactNode;
editor: React.ReactNode;
terminal: React.ReactNode;
}
export default function WorkspaceLayout({
problem,
editor,
terminal,
}: WorkspaceLayoutProps) {
return (
<div className="h-screen flex flex-col">
<WorkspaceHeader />
<main className="flex flex-grow overflow-y-hidden p-2.5 pt-0">
<ResizablePanelGroup direction="horizontal" className="relative h-full flex">
<ResizablePanel defaultSize={50} className="border border-muted rounded-3xl">
{problem}
</ResizablePanel>
<ResizableHandle className="mx-1 bg-transparent hover:bg-blue-500" />
<ResizablePanel defaultSize={50}>
<ResizablePanelGroup direction="vertical">
<ResizablePanel defaultSize={75} className="border border-muted rounded-3xl">
{editor}
</ResizablePanel>
<ResizableHandle className="my-1 bg-transparent hover:bg-blue-500" />
<ResizablePanel defaultSize={25} className="border border-muted rounded-3xl">
{terminal}
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
</ResizablePanelGroup>
</main>
</div>
);
}