-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDashboardSidebarLinks.tsx
79 lines (77 loc) · 2.88 KB
/
DashboardSidebarLinks.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { dashboard_routes } from "@/components/navigation/routes";
import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { Link, useLocation } from "@tanstack/react-router";
import { Plus } from "lucide-react";
interface DashboardSidebarLinksProps {}
export function DashboardSidebarLinks({}: DashboardSidebarLinksProps) {
const { state, setOpen, setOpenMobile, isMobile } = useSidebar();
const { pathname } = useLocation();
return (
<SidebarGroup className="h-full bg-base-100">
<SidebarGroupLabel>Dashboard</SidebarGroupLabel>
<SidebarMenu className="gap-2">
{dashboard_routes.map((item) => {
return (
<SidebarMenuItem key={item.name}>
<SidebarMenuButton asChild>
<TooltipProvider>
<Tooltip
defaultOpen={false}
delayDuration={10}
disableHoverableContent
>
<TooltipTrigger
asChild
className={
pathname === item.href
? `flex w-full gap-3 rounded-lg bg-primary/30 p-1`
: `flex w-full gap-3 rounded-sm p-1 hover:bg-base-300`
}
>
<span className="justify-betweenrounded-sm flex h-full w-full items-center gap-3 p-1">
<Link
className="flex w-full gap-3 rounded-sm"
to={item.href}
onClick={() => {
if (isMobile) {
setOpen(false);
setOpenMobile(false);
}
}}
>
<button className="size-6 text-primary">
{item.icon}
</button>
{/* {isMobile&&<span className="text-lg">{item.name}</span>} */}
{(state === "expanded" || isMobile) && (
<span className="text-lg">{item.name}</span>
)}
</Link>
{item.href === "/dashboard/os-projects" && <Plus />}
{item.href === "/dashboard/teams" && <Plus />}
</span>
</TooltipTrigger>
<TooltipContent side={"right"}>{item.name}</TooltipContent>
</Tooltip>
</TooltipProvider>
</SidebarMenuButton>
</SidebarMenuItem>
);
})}
</SidebarMenu>
</SidebarGroup>
);
}