-
Notifications
You must be signed in to change notification settings - Fork 1
/
layout.tsx
60 lines (56 loc) · 1.43 KB
/
layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import ConvexClientProvider from "@/components/ConvexClientProvider";
import { cn } from "@/lib/utils";
import { ChatBubbleIcon, HomeIcon, ReaderIcon } from "@radix-ui/react-icons";
import Link from "next/link";
import { ReactNode } from "react";
export default function ProductLayout({ children }: { children: ReactNode }) {
return (
<ConvexClientProvider>
<div className="flex min-h-screen w-full">
<ProductMenu />
{children}
</div>
</ConvexClientProvider>
);
}
function ProductMenu() {
return (
<aside className="w-48 border-r bg-muted/40 p-2">
<nav className="flex h-full max-h-screen flex-col gap-2">
<MenuLink href="/product" active>
<ChatBubbleIcon className="h-4 w-4" />
Chat
</MenuLink>
<MenuLink href="https://docs.convex.dev">
<ReaderIcon className="h-4 w-4" />
Docs
</MenuLink>
<MenuLink href="/">
<HomeIcon className="h-4 w-4" />
Home
</MenuLink>
</nav>
</aside>
);
}
function MenuLink({
active,
href,
children,
}: {
active?: boolean;
href: string;
children: ReactNode;
}) {
return (
<Link
href={href}
className={cn(
"flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-all hover:text-primary",
active && "bg-muted text-primary",
)}
>
{children}
</Link>
);
}