Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Highlight the documentation type based on href

Vasek Mlejnsky36088654bc40
diff --git a/apps/web/src/components/Navigation/DocsTypeItems.tsx b/apps/web/src/components/Navigation/DocsTypeItems.tsx
index bd420b500..3c4ae954d 100644
--- a/apps/web/src/components/Navigation/DocsTypeItems.tsx
+++ b/apps/web/src/components/Navigation/DocsTypeItems.tsx
@@ -1,4 +1,6 @@
import Link from 'next/link'
+import clsx from 'clsx'
+import { usePathname } from 'next/navigation'
import { BookIcon, BracesIcon } from 'lucide-react'
function Item({
@@ -10,12 +12,23 @@ function Item({
icon: React.ReactNode
title: string
}) {
+ const pathname = usePathname()
+ console.log(pathname, href)
+ const isActive = pathname === href
return (
- <Link href={href} className="text-xs text-brand-400 flex items-center gap-2 group p-1 transition-all">
- <div className="flex items-center justify-center p-2 rounded-md bg-gradient-to-b from-gray-700 to-gray-900 shadow-md group-hover:bg-gradient-to-b group-hover:from-brand-800 group-hover:to-brand-400 border border-white/20 group-hover:border-brand-400">
+ <Link href={href} className={clsx(
+ 'text-xs flex items-center gap-2 group p-1 transition-all',
+ )}>
+ <div className={clsx(
+ 'flex items-center justify-center p-2 rounded-md bg-gradient-to-b shadow-md group-hover:from-brand-800 group-hover:to-brand-400 border border-white/20 group-hover:border-brand-400',
+ isActive ? 'from-brand-800 to-brand-400 border-brand-400' : 'from-gray-700 to-gray-900 border-white/20'
+ )}>
{icon}
</div>
- <span className="font-semibold text-zinc-400 group-hover:text-white">{title}</span>
+ <span className={clsx(
+ 'font-semibold',
+ isActive ? 'text-white' : 'text-zinc-400 group-hover:text-white'
+ )}>{title}</span>
</Link>
)
}