Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: update mobile navbar

Dillion Verma0a9f0df56aec
diff --git a/components/mobile-nav.tsx b/components/mobile-nav.tsx
index c5ee7a2a..cdaf590d 100644
--- a/components/mobile-nav.tsx
+++ b/components/mobile-nav.tsx
@@ -4,6 +4,7 @@ import * as React from "react";
import Link, { LinkProps } from "next/link";
import { useRouter } from "next/navigation";
import { SidebarOpen } from "lucide-react";
+import posthog from "posthog-js";
import { docsConfig } from "@/config/docs";
import { siteConfig } from "@/config/site";
@@ -55,27 +56,41 @@ export function MobileNav() {
{docsConfig.sidebarNav.map((item, index) => (
<div key={index} className="flex flex-col space-y-3 pt-6">
<h4 className="font-medium">{item.title}</h4>
- {item.items?.map((item) => (
- <React.Fragment key={item.href}>
- {!item.disabled &&
- (item.href ? (
- <MobileLink
- href={item.href}
- onOpenChange={setOpen}
- className="text-muted-foreground"
- >
- {item.title}
- {item.label && (
- <span className="ml-2 rounded-md bg-[#FFBD7A] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
- {item.label}
- </span>
- )}
- </MobileLink>
- ) : (
- item.title
- ))}
- </React.Fragment>
- ))}
+ {item.items?.map((item) =>
+ !item.disabled && item.href ? (
+ <MobileLink
+ href={item.href}
+ onOpenChange={setOpen}
+ onClick={() => item.event && posthog.capture(item.event)}
+ className={cn(
+ "text-muted-foreground",
+ item.disabled && "cursor-not-allowed opacity-60",
+ )}
+ >
+ {item.title}
+ {item.label && (
+ <span className="ml-2 rounded-md bg-[#FFBD7A] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ {item.label}
+ </span>
+ )}
+ </MobileLink>
+ ) : (
+ <span
+ key={index}
+ className={cn(
+ "text-muted-foreground",
+ item.disabled && "cursor-not-allowed opacity-60",
+ )}
+ >
+ {item.title}
+ {item.label && (
+ <span className="ml-2 rounded-md bg-muted px-1.5 py-0.5 text-xs leading-none text-muted-foreground no-underline group-hover:no-underline">
+ {item.label}
+ </span>
+ )}
+ </span>
+ ),
+ )}
</div>
))}
</div>