55 lines
3.0 KiB
Plaintext
55 lines
3.0 KiB
Plaintext
---
|
|
import { t, localePath, getLocaleLabel, type Locale } from '../i18n/utils';
|
|
|
|
interface Props {
|
|
locale: Locale;
|
|
}
|
|
|
|
const { locale } = Astro.props;
|
|
const currentPath = Astro.url.pathname.replace(new RegExp(`^/(zh|zh_Hant|en)`), '');
|
|
const nav = t(locale, 'nav');
|
|
const footer = t(locale, 'footer');
|
|
const otherLocales: Locale[] = (['zh', 'zh_Hant', 'en'] as Locale[]).filter((l) => l !== locale);
|
|
---
|
|
|
|
<header class="w-full border-b border-slate-200 bg-white sticky top-0 z-50">
|
|
<div class="flex h-16 md:h-20 items-center justify-between gap-3 px-5 md:px-20">
|
|
<a href={localePath(locale, '/')} class="flex min-w-0 items-center gap-2 md:gap-3 shrink">
|
|
<img src="/images/logo.png" alt="MeiYao" class="w-8 h-8 md:w-9 md:h-9 shrink-0" />
|
|
<span class="truncate text-slate-900 text-lg md:text-xl font-bold whitespace-nowrap">{footer.brandName}</span>
|
|
</a>
|
|
|
|
<nav class="hidden md:flex items-center gap-8">
|
|
<a href={localePath(locale, '/features')} class="text-slate-600 text-sm hover:text-slate-900 whitespace-nowrap">{nav.features}</a>
|
|
<a href={localePath(locale, '/pricing')} class="text-slate-600 text-sm hover:text-slate-900 whitespace-nowrap">{nav.pricing}</a>
|
|
<a href={localePath(locale, '/about')} class="text-slate-600 text-sm hover:text-slate-900 whitespace-nowrap">{nav.about}</a>
|
|
</nav>
|
|
|
|
<div class="flex items-center gap-3 md:gap-4 shrink-0">
|
|
<details class="relative">
|
|
<summary class="flex list-none items-center gap-1 px-2 py-1.5 text-xs text-slate-600 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 whitespace-nowrap cursor-pointer">
|
|
{getLocaleLabel(locale)}
|
|
<svg class="w-3 h-3 text-slate-400" viewBox="0 0 12 12" fill="none"><path d="M3 5l3 3 3-3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
</summary>
|
|
<div class="absolute right-0 top-full mt-1 min-w-full bg-white border border-slate-200 rounded-lg shadow-lg py-1 z-50">
|
|
{otherLocales.map((l) => (
|
|
<a href={localePath(l, currentPath)} class="block px-4 py-2 text-sm text-slate-600 hover:bg-slate-50 hover:text-slate-900 whitespace-nowrap">
|
|
{getLocaleLabel(l)}
|
|
</a>
|
|
))}
|
|
</div>
|
|
</details>
|
|
|
|
<a href={localePath(locale, '/login')} class="bg-violet-600 text-white text-xs md:text-sm font-semibold px-4 md:px-5 py-2 md:py-2.5 rounded-lg hover:bg-violet-700 transition-colors whitespace-nowrap">
|
|
{nav.getStarted}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<nav class="grid grid-cols-3 border-t border-slate-100 px-5 py-2 text-center md:hidden">
|
|
<a href={localePath(locale, '/features')} class="text-slate-600 text-sm font-medium hover:text-slate-900">{nav.features}</a>
|
|
<a href={localePath(locale, '/pricing')} class="text-slate-600 text-sm font-medium hover:text-slate-900">{nav.pricing}</a>
|
|
<a href={localePath(locale, '/about')} class="text-slate-600 text-sm font-medium hover:text-slate-900">{nav.about}</a>
|
|
</nav>
|
|
</header>
|