Files
nextgo/app/components/TopBar.tsx
Beyhan Oğur 9eb7aea821 first commit
2026-04-26 22:15:25 +03:00

60 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client'
import Link from 'next/link'
import ThemeToggle from './ThemeToggle'
import { signOut } from 'next-auth/react'
import { Button } from '@/components/ui/button'
import { LogOut, Zap } from 'lucide-react'
type Props = {
isLoggedIn: boolean
}
export default function TopBar({ isLoggedIn }: Props) {
async function onLogout() {
await signOut({ callbackUrl: '/auth/login' })
}
return (
<header className="sticky top-0 z-50 border-b bg-background/80 backdrop-blur-sm">
<div className="mx-auto flex w-full max-w-7xl items-center justify-between px-4 py-2.5">
{/* Logo */}
<Link href="/" className="flex items-center gap-2">
<div className="flex h-7 w-7 items-center justify-center rounded-lg bg-primary text-primary-foreground">
<Zap className="size-4" />
</div>
<span className="text-base font-bold tracking-tight">NextGo</span>
</Link>
{/* Actions */}
<nav className="flex items-center gap-1">
<ThemeToggle />
{isLoggedIn ? (
<>
<Button variant="ghost" size="sm" asChild>
<Link href="/admin/users">Admin</Link>
</Button>
<Button type="button" onClick={onLogout} variant="destructive" size="sm">
<LogOut className="size-4" />
Çıkış
</Button>
</>
) : (
<>
<Button variant="ghost" size="sm" asChild>
<Link href="/auth/login">Giriş</Link>
</Button>
<Button size="sm" asChild>
<Link href="/auth/register">Kayıt Ol</Link>
</Button>
</>
)}
</nav>
</div>
</header>
)
}