diff --git a/site/src/components/Footer.astro b/site/src/components/Footer.astro new file mode 100644 index 0000000..d9e2ed5 --- /dev/null +++ b/site/src/components/Footer.astro @@ -0,0 +1,17 @@ +--- +import { useTranslations, type Locale } from "../i18n/ui"; +interface Props { locale: Locale; } +const { locale } = Astro.props; +const t = useTranslations(locale); +const year = new Date().getFullYear(); +--- + diff --git a/site/src/components/LangPicker.astro b/site/src/components/LangPicker.astro new file mode 100644 index 0000000..1c6ec6b --- /dev/null +++ b/site/src/components/LangPicker.astro @@ -0,0 +1,25 @@ +--- +import { locales, defaultLocale, type Locale } from "../i18n/ui"; + +interface Props { + locale: Locale; + path: string; // unprefixed path, e.g. "/install" or "/" +} +const { locale, path } = Astro.props; +const labels: Record = { + en: "EN", + "zh-CN": "中文", + it: "IT", + fr: "FR", + es: "ES", +}; +const href = (l: Locale) => (l === defaultLocale ? path : `/${l}${path}`); +--- +
+ {locales.map((l) => ( + {labels[l]} + ))} +
diff --git a/site/src/components/Nav.astro b/site/src/components/Nav.astro new file mode 100644 index 0000000..a39774d --- /dev/null +++ b/site/src/components/Nav.astro @@ -0,0 +1,28 @@ +--- +import { defaultLocale, useTranslations, type Locale } from "../i18n/ui"; +import ThemeToggle from "./ThemeToggle.astro"; +import LangPicker from "./LangPicker.astro"; + +interface Props { + locale: Locale; + path: string; +} +const { locale, path } = Astro.props; +const t = useTranslations(locale); +const p = (sub: string) => (locale === defaultLocale ? sub : `/${locale}${sub}`); +--- +
+ +
diff --git a/site/src/components/ThemeToggle.astro b/site/src/components/ThemeToggle.astro new file mode 100644 index 0000000..a8a1c03 --- /dev/null +++ b/site/src/components/ThemeToggle.astro @@ -0,0 +1,32 @@ +--- +// Tiny client island: flips data-theme + persists. Contract: writes "frappe"|"latte". +--- + +