Files
Dorod-Sky/skyvern-frontend/src/routes/root/RootLayout.tsx

68 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-04-01 21:34:52 +03:00
import { Link, Outlet } from "react-router-dom";
import { Toaster } from "@/components/ui/toaster";
import { SideNav } from "./SideNav";
import { PinLeftIcon, PinRightIcon } from "@radix-ui/react-icons";
import { Logo } from "@/components/Logo";
import { useState } from "react";
import { cn } from "@/util/utils";
import { Button } from "@/components/ui/button";
import { LogoMinimized } from "@/components/LogoMinimized";
import { Header } from "./Header";
2024-04-15 11:54:12 -07:00
2024-05-07 11:31:05 -07:00
function RootLayout() {
const [sidebarCollapsed, setSidebarCollapsed] = useState(false);
2024-04-01 21:34:52 +03:00
return (
<>
<div className="h-full w-full">
<aside
className={cn("fixed h-screen min-h-screen border-r-2 px-6", {
"w-64": !sidebarCollapsed,
"w-28": sidebarCollapsed,
})}
>
<div className="flex h-full flex-col">
<Link to={window.location.origin}>
<div className="flex h-24 items-center">
{sidebarCollapsed ? <LogoMinimized /> : <Logo />}
</div>
</Link>
<SideNav collapsed={sidebarCollapsed} />
<div
className={cn("mt-auto flex min-h-16", {
"justify-center": sidebarCollapsed,
"justify-end": !sidebarCollapsed,
})}
>
<Button
size="icon"
variant="ghost"
onClick={() => {
setSidebarCollapsed(!sidebarCollapsed);
}}
>
{sidebarCollapsed ? (
<PinRightIcon className="h-6 w-6" />
) : (
<PinLeftIcon className="h-6 w-6" />
)}
</Button>
2024-04-15 11:54:12 -07:00
</div>
</div>
2024-04-01 21:34:52 +03:00
</aside>
<Header />
<main
className={cn("pb-4 pl-64", {
"pl-28": sidebarCollapsed,
})}
>
2024-04-01 21:34:52 +03:00
<Outlet />
</main>
</div>
<Toaster />
</>
);
}
export { RootLayout };