Files
knur-app/components/nav.tsx

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2026-06-16 09:43:48 +02:00
import Link from "next/link";
2026-06-18 11:02:31 +02:00
import { auth, signOut } from "@/auth";
2026-06-22 15:19:38 +02:00
import { NavLinks } from "./nav-links";
2026-06-18 11:02:31 +02:00
import { SignOutButton } from "./sign-out-button";
2026-06-22 15:19:38 +02:00
import { Wordmark } from "./wordmark";
2026-06-16 09:43:48 +02:00
2026-06-18 11:02:31 +02:00
export async function Nav() {
const session = await auth();
const signOutAction = async () => {
"use server";
await signOut({ redirectTo: "/login" });
};
2026-06-16 09:43:48 +02:00
return (
2026-06-22 15:19:38 +02:00
<header className="sticky top-0 z-50 border-b border-white/10 bg-surface/70 backdrop-blur-xl">
2026-06-16 09:43:48 +02:00
<div className="mx-auto flex max-w-5xl items-center justify-between px-4 py-3 sm:px-6">
2026-06-22 15:19:38 +02:00
<Link href="/" className="flex items-center gap-2.5 text-lg font-bold text-fg">
2026-06-16 09:43:48 +02:00
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
2026-06-22 15:19:38 +02:00
src="/logo-bars.svg"
alt="KNUR.APP"
width={51}
height={48}
className="h-7 w-auto sm:h-8"
2026-06-16 09:43:48 +02:00
/>
2026-06-22 15:19:38 +02:00
<Wordmark className="hidden text-2xl sm:block" />
2026-06-16 09:43:48 +02:00
</Link>
<nav className="flex items-center gap-1 sm:gap-2">
2026-06-22 15:19:38 +02:00
<NavLinks />
2026-06-18 11:02:31 +02:00
{session?.user?.name && (
<span className="hidden px-2 text-xs text-fg/40 sm:inline">
{session.user.name}
</span>
)}
<SignOutButton action={signOutAction} />
2026-06-16 09:43:48 +02:00
</nav>
</div>
</header>
);
}