| 18 | type User = Database["public"]["Tables"]["users"]["Row"] |
| 19 | |
| 20 | export function MainNav({ |
| 21 | className, |
| 22 | account, |
| 23 | ...props |
| 24 | }: React.HTMLAttributes<HTMLElement> & { account: User }) { |
| 25 | const pathname = usePathname() |
| 26 | |
| 27 | return ( |
| 28 | <nav |
| 29 | className={cn("flex items-center", className)} |
| 30 | {...props} |
| 31 | > |
| 32 | <div className="hidden md:flex space-x-6 items-center"> |
| 33 | {mainNavItems.map((item, index) => ( |
| 34 | <Link |
| 35 | key={index} |
| 36 | href={item.href} |
| 37 | className={cn( |
| 38 | "text-sm font-medium transition-colors hover:text-primary leading-none", |
| 39 | pathname.startsWith(item.href) ? "text-foreground" : "text-muted-foreground" |
| 40 | )} |
| 41 | > |
| 42 | {item.label} |
| 43 | </Link> |
| 44 | ))} |
| 45 | </div> |
| 46 | <div className="md:hidden"> |
| 47 | <DropdownMenu> |
| 48 | <DropdownMenuTrigger asChild> |
| 49 | <Button variant="ghost" size="sm"> |
| 50 | <Menu className="h-5 w-5" /> |
| 51 | </Button> |
| 52 | </DropdownMenuTrigger> |
| 53 | <DropdownMenuContent align="start"> |
| 54 | {mainNavItems.map((item, index) => ( |
| 55 | <DropdownMenuItem key={index} asChild> |
| 56 | <Link |
| 57 | href={item.href} |
| 58 | className={cn( |
| 59 | "w-full", |
| 60 | pathname.startsWith(item.href) ? "font-bold" : "" |
| 61 | )} |
| 62 | > |
| 63 | {item.label} |
| 64 | </Link> |
| 65 | </DropdownMenuItem> |
| 66 | ))} |
| 67 | </DropdownMenuContent> |
| 68 | </DropdownMenu> |
| 69 | </div> |
| 70 | </nav> |
| 71 | ) |
| 72 | } |