MCPcopy
hub / github.com/d3george/slash-admin / NavSubItem

Function NavSubItem

src/components/nav/mini/nav-sub-item.tsx:9–59  ·  view source on GitHub ↗
(item: NavItemProps)

Source from the content-addressed store, hash-verified

7import type { NavItemProps } from "../types";
8
9export const NavSubItem = (item: NavItemProps) => {
10 const { t } = useLocale();
11
12 const content = (
13 <>
14 {/* Icon */}
15 <span style={navItemStyles.icon} className="mr-1 items-center justify-center">
16 {item.icon && typeof item.icon === "string" ? <Icon icon={item.icon} /> : item.icon}
17 </span>
18
19 {/* Title */}
20 <span style={navItemStyles.title} className="flex-auto">
21 {t(item.title)}
22 </span>
23
24 {/* Caption */}
25 {item.caption && (
26 <TooltipProvider>
27 <Tooltip>
28 <TooltipTrigger>
29 <Icon icon="solar:info-circle-linear" size={16} />
30 </TooltipTrigger>
31 <TooltipContent>
32 <p>{t(item.caption)}</p>
33 </TooltipContent>
34 </Tooltip>
35 </TooltipProvider>
36 )}
37
38 {/* Info */}
39 {item.info && <span style={navItemStyles.info}>{item.info}</span>}
40
41 {/* Arrow */}
42 {item.hasChild && <Icon icon="eva:arrow-ios-forward-fill" style={navItemStyles.arrow} />}
43 </>
44 );
45
46 const itemClassName = cn(
47 navItemClasses.base,
48 navItemClasses.hover,
49 item.active && item.depth === 1 && navItemClasses.active,
50 item.active && item.depth !== 1 && "bg-action-hover!",
51 item.disabled && navItemClasses.disabled,
52 );
53
54 return (
55 <NavItemRenderer item={item} className={itemClassName}>
56 {content}
57 </NavItemRenderer>
58 );
59};

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useLocaleFunction · 0.85

Tested by

no test coverage detected