Files
eu/components/header.tsx
T
2026-06-23 15:32:52 +03:00

41 lines
1.3 KiB
TypeScript

import Image from "next/image";
import { Button } from "./ui/button";
import login from "@/app/actions/login";
import { getCurrentUser } from "@/lib/user";
import Link from "next/link";
import { getNavLinks } from "@/lib/navlinks/repository";
export default async function Header() {
const user = await getCurrentUser();
const links = await getNavLinks();
return (
<header className="relative flex items-center justify-between w-full h-16 px-8 bg-gray-100">
<Link href="/" className="flex items-center gap-4">
<Image
src="/emblem.png"
width={28}
height={28}
alt="Emblem of the European Federation"
/>
<h3>European Federation</h3>
</Link>
<div className="absolute left-1/2 -translate-x-1/2 flex items-center gap-6">
{
links.map((link) => (
<Link className="hover:underline underline-offset-8 decoration-2 duration-200" key={link.id} href={link.href || `/${link.page.type.toLowerCase()}/${link.page.slug}`}><h3>{link.label ?? link.page?.title}</h3></Link>
))
}
</div>
{
user ? (
<Link href="/account"><Button>Account</Button></Link>
) : (
<form action={login}>
<Button size="lg" type="submit">Sign in with Kotosoft ID</Button>
</form>
)
}
</header>
)
}