35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
import Link from 'next/link'
|
|
import { locales, type Dict, type Locale } from '@/i18n'
|
|
|
|
export function Header({ t, locale, showProjects, showNews }: { t: Dict; locale: Locale; showProjects: boolean; showNews: boolean }) {
|
|
const links = [
|
|
['#mission', t.nav.mission, true],
|
|
['#directions', t.nav.directions, true],
|
|
['#projects', t.nav.projects, showProjects],
|
|
['#news', t.nav.news, showNews],
|
|
['#collaboration', t.nav.collaboration, true],
|
|
] as const
|
|
return (
|
|
<header className="absolute inset-x-0 top-0 z-10">
|
|
<div className="mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-x-8 gap-y-3 px-5 py-6 sm:px-8">
|
|
<Link href={`/${locale}`} className="font-serif text-lg tracking-wide">
|
|
{t.siteName}
|
|
</Link>
|
|
<nav className="order-3 flex w-full flex-wrap gap-x-6 gap-y-2 text-sm text-muted md:order-2 md:w-auto">
|
|
{links.filter((l) => l[2]).map(([href, label]) => (
|
|
<a key={href} href={href} className="hover:text-burgundy">{label}</a>
|
|
))}
|
|
</nav>
|
|
<div className="order-2 flex gap-3 text-sm md:order-3" aria-label={t.language}>
|
|
{locales.map((l) => (
|
|
<Link key={l} href={`/${l}`} hrefLang={l} aria-current={l === locale ? 'true' : undefined}
|
|
className={l === locale ? 'font-semibold text-burgundy' : 'text-muted hover:text-burgundy'}>
|
|
{l.toUpperCase()}
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</header>
|
|
)
|
|
}
|