-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain-nav.tsx
41 lines (38 loc) · 1.12 KB
/
main-nav.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as React from "react"
import Link from "next/link"
import { NavItem } from "@/types/nav"
import { siteConfig } from "@/config/site"
import { cn } from "@/lib/utils"
import { Icons } from "@/components/icons"
interface MainNavProps {
items?: NavItem[]
}
export function MainNav({ items }: MainNavProps) {
return (
<div className="flex gap-6 md:gap-10">
<Link href="/" className="flex items-center space-x-2">
<Icons.logo className="h-6 w-6" />
<span className="inline-block font-bold">{siteConfig.name}</span>
</Link>
{items?.length ? (
<nav className="flex gap-6">
{items?.map(
(item, index) =>
item.href && (
<Link
key={index}
href={item.href}
className={cn(
"flex items-center text-sm font-medium text-muted-foreground",
item.disabled && "cursor-not-allowed opacity-80"
)}
>
{item.title}
</Link>
)
)}
</nav>
) : null}
</div>
)
}