Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
tsx 69 lines 1.87 KB
Raw
1 'use client';
2
3 import Link from 'next/link';
4 import Image from 'next/image';
5 import { usePathname } from 'next/navigation';
6
7 const navItems = [
8 { href: '/docs', label: 'Docs' },
9 { href: '/examples', label: 'Examples' },
10 { href: '/docs/api', label: 'API' },
11 ];
12
13 export function TopNav() {
14 const pathname = usePathname();
15
16 const isActive = (href: string) => {
17 if (href === '/docs') {
18 return pathname === '/docs' ||
19 (pathname.startsWith('/docs') &&
20 !pathname.startsWith('/docs/api'));
21 }
22 return pathname.startsWith(href);
23 };
24
25 return (
26 <header className="sticky top-0 z-50 border-b border-fd-border bg-fd-background">
27 <div className="flex h-14 items-center px-6 gap-6">
28 {/* Logo */}
29 <Link href="/" className="flex items-center">
30 <Image
31 src="/Composio Logo.svg"
32 alt="Composio"
33 width={110}
34 height={20}
35 className="dark:hidden"
36 priority
37 />
38 <Image
39 src="/Composio Logo Dark.svg"
40 alt="Composio"
41 width={110}
42 height={20}
43 className="hidden dark:block"
44 priority
45 />
46 </Link>
47
48 {/* Nav Items */}
49 <nav className="flex items-center gap-1">
50 {navItems.map((item) => (
51 <Link
52 key={item.href}
53 href={item.href}
54 className={`px-3 py-1.5 text-sm font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 ${
55 isActive(item.href)
56 ? 'text-[var(--composio-orange)]'
57 : 'text-fd-muted-foreground hover:text-fd-foreground'
58 }`}
59 >
60 {item.label}
61 </Link>
62 ))}
63 </nav>
64
65 </div>
66 </header>
67 );
68 }
69