MCPcopy Create free account
hub / github.com/fastapi/full-stack-fastapi-template / Main

Function Main

frontend/src/components/Sidebar/Main.tsx:23–60  ·  view source on GitHub ↗
({ items }: MainProps)

Source from the content-addressed store, hash-verified

21}
22
23export function Main({ items }: MainProps) {
24 const { isMobile, setOpenMobile } = useSidebar()
25 const router = useRouterState()
26 const currentPath = router.location.pathname
27
28 const handleMenuClick = () => {
29 if (isMobile) {
30 setOpenMobile(false)
31 }
32 }
33
34 return (
35 <SidebarGroup>
36 <SidebarGroupContent>
37 <SidebarMenu>
38 {items.map((item) => {
39 const isActive = currentPath === item.path
40
41 return (
42 <SidebarMenuItem key={item.title}>
43 <SidebarMenuButton
44 tooltip={item.title}
45 isActive={isActive}
46 asChild
47 >
48 <RouterLink to={item.path} onClick={handleMenuClick}>
49 <item.icon />
50 <span>{item.title}</span>
51 </RouterLink>
52 </SidebarMenuButton>
53 </SidebarMenuItem>
54 )
55 })}
56 </SidebarMenu>
57 </SidebarGroupContent>
58 </SidebarGroup>
59 )
60}

Callers

nothing calls this directly

Calls 1

useSidebarFunction · 0.90

Tested by

no test coverage detected