yo-next-auth/app/[locale]/(protected)/_components/navbar.tsx

34 lines
1.0 KiB
TypeScript

// eslint-disable-next-line validate-filename/naming-rules
'use client'
import { Button } from '@/components/ui/button'
import Link from 'next/link'
import { CABINET_ROUTES, USER_PROFILE_URL } from '@/config/routes'
import { usePathname } from 'next/navigation'
import UserButton from '@/components/auth/user-button'
import LocaleSwitcher from '@/components/locale-switcher'
export const Navbar = () => {
const pathname = usePathname()
console.log(USER_PROFILE_URL)
return (
<nav className="bg-secondary flex justify-between items-center top-0 absolute px-6 py-4 w-full shadow-sm">
<div className="flex gap-x-4">
{CABINET_ROUTES.map((route) => (
<Button asChild key={route} variant={pathname.endsWith(route) ? 'default' : 'outline'} className="border">
<Link href={route}>
{route[1]?.toUpperCase() + route.substring(2)}
</Link>
</Button>
))}
</div>
<div className="flex gap-x-2">
<LocaleSwitcher/>
<UserButton/>
</div>
</nav>
)
}