-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar.tsx
59 lines (55 loc) · 1.54 KB
/
sidebar.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
"use client";
import { cn } from "@/lib/utils";
import { Home, Plus, Settings } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";
export const Sidebar = () => {
const pathname = usePathname();
const router = useRouter();
const routes = [
{
icon: Home,
href: "/",
label: "Home",
pro: false,
},
{
icon: Plus,
href: "/companion/new",
label: "Create",
pro: true,
},
{
icon: Settings,
href: "/settings",
label: "Settings",
pro: false,
},
];
const onNavigate = (url: string, pro: boolean) => {
// TODO: check if pro
return router.push(url);
};
return (
<div className="space-y-4 flex flex-col h-full text-primary bg-secondary">
<div className="p-3 flex flex-1 justify-center">
<div className="space-y-2">
{routes.map((route) => (
<div
key={route.href}
onClick={() => onNavigate(route.href, route.pro)}
className={cn(
"text-muted-foreground text-xs group flex p-3 w-full justify-start font-medium cursor-pointer hover:text-primary hover:bg-primary/10 rounded-lg transition",
pathname === route.href && "bg-primary/10 text-primary"
)}
>
<div className="flex flex-col gap-y-2 items-center flex-1">
<route.icon className="h-5 w-5" />
{route.label}
</div>
</div>
))}
</div>
</div>
</div>
);
};