74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import { Brandmark } from '../components/Brandmark';
|
|
import { appUrl } from '../lib/links';
|
|
import { changeLanguage } from '../i18n';
|
|
import { cn } from '../lib/utils';
|
|
import type { Language } from '../i18n/language';
|
|
|
|
const LANGS: Language[] = ['pl', 'en'];
|
|
|
|
/** Pasek „systemowy” — sticky, jak topbar apki: znak, wersja, kotwice, język, CTA. */
|
|
export function SiteHeader() {
|
|
const { t, i18n } = useTranslation(['nav', 'common']);
|
|
const anchors = [
|
|
{ href: '#ekosystem', label: t('nav:anchors.ekosystem') },
|
|
{ href: '#slownik', label: t('nav:anchors.slownik') },
|
|
{ href: '#sciezki', label: t('nav:anchors.sciezki') },
|
|
];
|
|
|
|
return (
|
|
<header className="sticky top-0 z-50 border-b border-line bg-bg/85 backdrop-blur-md">
|
|
<div className="mx-auto flex h-14 w-full max-w-6xl items-center gap-3 px-5">
|
|
<a href="#gora" className="flex items-center gap-2.5 text-ink">
|
|
<Brandmark size={26} />
|
|
<span className="font-display text-[15px] font-bold tracking-tight">FitOS</span>
|
|
<span className="rounded-full border border-line bg-input px-2 py-0.5 font-mono text-[10px] text-dim">
|
|
{t('common:brandVersion')}
|
|
</span>
|
|
</a>
|
|
<nav
|
|
aria-label={t('nav:sectionsAria')}
|
|
className="ml-auto hidden items-center gap-5 sm:flex"
|
|
>
|
|
{anchors.map((a) => (
|
|
<a
|
|
key={a.href}
|
|
href={a.href}
|
|
className="text-[13px] font-medium text-dim transition-colors hover:text-ink"
|
|
>
|
|
{a.label}
|
|
</a>
|
|
))}
|
|
</nav>
|
|
<div
|
|
role="group"
|
|
aria-label={t('nav:langSwitchAria')}
|
|
className="ml-auto flex items-center gap-1.5 sm:ml-0"
|
|
>
|
|
{LANGS.map((lang) => (
|
|
<button
|
|
key={lang}
|
|
type="button"
|
|
aria-pressed={i18n.language === lang}
|
|
aria-label={lang === 'pl' ? t('nav:langPl') : t('nav:langEn')}
|
|
onClick={() => changeLanguage(lang)}
|
|
className={cn(
|
|
'font-mono text-[11px] font-semibold uppercase transition-colors',
|
|
i18n.language === lang ? 'text-ink' : 'text-dim hover:text-ink',
|
|
)}
|
|
>
|
|
{lang}
|
|
</button>
|
|
))}
|
|
</div>
|
|
<a
|
|
href={appUrl()}
|
|
className="inline-flex items-center gap-1 rounded-md border-0 bg-(image:--btn-grad) px-3.5 py-1.5 text-[13px] font-bold text-accent-ink shadow-(--btn-shadow) transition-transform hover:-translate-y-px"
|
|
>
|
|
{t('nav:launch')} <span aria-hidden="true">▸</span>
|
|
</a>
|
|
</div>
|
|
</header>
|
|
);
|
|
}
|