29 lines
851 B
TypeScript
29 lines
851 B
TypeScript
"use client";
|
|
|
|
import { Sidebar } from "@/components/dashboard/sidebar";
|
|
import { ReactNode, useState } from "react";
|
|
import { SidebarContext } from "@/components/layout/sidebar-context";
|
|
|
|
interface PageLayoutProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function PageLayout({ children }: PageLayoutProps) {
|
|
const [sidebarOpen, setSidebarOpen] = useState(false);
|
|
|
|
return (
|
|
<SidebarContext.Provider
|
|
value={{ open: sidebarOpen, setOpen: setSidebarOpen }}
|
|
>
|
|
<div className="flex h-screen bg-background overflow-hidden">
|
|
<Sidebar open={sidebarOpen} onOpenChange={setSidebarOpen} />
|
|
<main className="flex-1 overflow-auto overflow-x-hidden">
|
|
<div className="p-4 md:p-6 space-y-4 md:space-y-6 max-w-full">
|
|
{children}
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</SidebarContext.Provider>
|
|
);
|
|
}
|