31 lines
849 B
TypeScript
31 lines
849 B
TypeScript
"use client";
|
|
|
|
import type { ComponentProps, ReactNode } from "react";
|
|
import { usePathname } from "next/navigation";
|
|
import { TopNavbar } from "@/components/top-navbar";
|
|
|
|
type AdminLayoutShellProps = ComponentProps<typeof TopNavbar> & {
|
|
children: ReactNode;
|
|
};
|
|
|
|
function shouldHideSidebarChrome(pathname: string) {
|
|
return pathname === "/settings" || pathname.startsWith("/settings/");
|
|
}
|
|
|
|
export function AdminLayoutShell({
|
|
children,
|
|
...topNavbarProps
|
|
}: AdminLayoutShellProps) {
|
|
const pathname = usePathname();
|
|
const hideSidebarChrome = shouldHideSidebarChrome(pathname);
|
|
|
|
return (
|
|
<div className="flex min-h-screen flex-col bg-background">
|
|
{hideSidebarChrome ? null : <TopNavbar {...topNavbarProps} />}
|
|
<div className={hideSidebarChrome ? "flex-1" : "flex-1 pl-16"}>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|