mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-10 08:48:29 +00:00
44 lines
1016 B
TypeScript
44 lines
1016 B
TypeScript
import { useUser } from "~/hooks/useUser";
|
|
import {
|
|
SidebarFooter,
|
|
SidebarGroup,
|
|
SidebarGroupContent,
|
|
SidebarMenu,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
} from "../ui/sidebar";
|
|
import { NavUser } from "./nav-user";
|
|
import { useLocation } from "@remix-run/react";
|
|
|
|
export const NavMain = ({
|
|
items,
|
|
}: {
|
|
items: {
|
|
title: string;
|
|
url: string;
|
|
icon?: any;
|
|
}[];
|
|
}) => {
|
|
const location = useLocation();
|
|
|
|
return (
|
|
<SidebarGroup>
|
|
<SidebarGroupContent className="flex flex-col gap-2">
|
|
<SidebarMenu>
|
|
{items.map((item) => (
|
|
<SidebarMenuItem key={item.title}>
|
|
<SidebarMenuButton
|
|
tooltip={item.title}
|
|
isActive={location.pathname.includes(item.url)}
|
|
>
|
|
{item.icon && <item.icon />}
|
|
<span>{item.title}</span>
|
|
</SidebarMenuButton>
|
|
</SidebarMenuItem>
|
|
))}
|
|
</SidebarMenu>
|
|
</SidebarGroupContent>
|
|
</SidebarGroup>
|
|
);
|
|
};
|