MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / NavLink

Function NavLink

apps/baseai.dev/src/components/Navigation.tsx:87–136  ·  view source on GitHub ↗
({
	href,
	children,
	tag,
	active = false,
	isAnchorLink = false,
	navRef
}: {
	href: string;
	children: React.ReactNode;
	tag?: string;
	active?: boolean;
	isAnchorLink?: boolean;
	navRef?: React.RefObject<HTMLAnchorElement | null>;
})

Source from the content-addressed store, hash-verified

85}
86
87function NavLink({
88 href,
89 children,
90 tag,
91 active = false,
92 isAnchorLink = false,
93 navRef
94}: {
95 href: string;
96 children: React.ReactNode;
97 tag?: string;
98 active?: boolean;
99 isAnchorLink?: boolean;
100 navRef?: React.RefObject<HTMLAnchorElement | null>;
101}) {
102 const number = children?.toString().split('.')[0];
103 const hasNumber = isNaN(parseInt(number!)) === false;
104 let content = children;
105
106 if (hasNumber) {
107 content = children?.toString().split('.').slice(1).join('.');
108 }
109
110 return (
111 <Link
112 href={href}
113 aria-current={active ? 'page' : undefined}
114 ref={navRef}
115 className={clsx(
116 'flex scroll-mt-16 items-center gap-2 py-1 pr-3 text-sm transition',
117 isAnchorLink ? 'pl-7' : 'pl-4',
118 active
119 ? 'text-zinc-900 dark:text-white'
120 : 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white'
121 )}
122 >
123 {hasNumber && (
124 <code className="mr-2 flex w-auto justify-end rounded-md bg-muted/60 px-2 opacity-50 ring-2 ring-muted">
125 {number}
126 </code>
127 )}
128 <span className="truncate">{content}</span>
129 {tag && (
130 <Tag variant="small" color="zinc">
131 {tag}
132 </Tag>
133 )}
134 </Link>
135 );
136}
137
138function NavigationGroup({
139 group,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected