diff --git a/astro.config.mjs b/astro.config.mjs index 80a3623..371ea6c 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -12,4 +12,5 @@ export default defineConfig({ }, }, integrations: [react(), tailwind(), mdx()], + viewTransitions: true, }) diff --git a/src/components/astro/head/root.astro b/src/components/astro/head/root.astro new file mode 100644 index 0000000..e045c17 --- /dev/null +++ b/src/components/astro/head/root.astro @@ -0,0 +1,14 @@ +--- +import { en, zh } from "~/config" +import { getLangFromUrl } from "~/i18n/utils" + +const lang = getLangFromUrl(Astro.url) +const config = lang === "zh" ? zh.meta : en.meta +--- + + + + + +{config.title} - {config.slogan} + diff --git a/src/components/astro/header.astro b/src/components/astro/header.astro index e2f8779..b78200a 100644 --- a/src/components/astro/header.astro +++ b/src/components/astro/header.astro @@ -1,7 +1,7 @@ --- import { Rss } from "lucide-react" -import ThemeToggle from "~/components/astro/theme-toggle.astro" import { LanguageToggle } from "~/components/react/language-toggle" +import { ThemeToggle } from "~/components/react/theme-toggle" import { en, zh } from "~/config" import { getLangFromUrl } from "~/i18n/utils" @@ -31,6 +31,6 @@ const config = lang === "zh" ? zh : en } - + diff --git a/src/components/react/noise-bg.tsx b/src/components/react/noise-background.tsx similarity index 85% rename from src/components/react/noise-bg.tsx rename to src/components/react/noise-background.tsx index 5967108..93a9547 100644 --- a/src/components/react/noise-bg.tsx +++ b/src/components/react/noise-background.tsx @@ -1,4 +1,4 @@ -export function NoiseBg() { +export function NoiseBackground() { return (
) diff --git a/src/components/astro/theme-toggle.astro b/src/components/react/theme-toggle.tsx similarity index 65% rename from src/components/astro/theme-toggle.astro rename to src/components/react/theme-toggle.tsx index c62b80d..00419aa 100644 --- a/src/components/astro/theme-toggle.astro +++ b/src/components/react/theme-toggle.tsx @@ -1,23 +1,15 @@ ---- import { Moon, Sun } from "lucide-react" ---- - - - + return ( + + ) +} diff --git a/src/layouts/base.astro b/src/layouts/base.astro index 967874d..48650d2 100644 --- a/src/layouts/base.astro +++ b/src/layouts/base.astro @@ -1,47 +1,44 @@ --- import "~/styles/globals.css" -import { NoiseBg } from "~/components/react/noise-bg" -import { en, zh } from "~/config" +import { NoiseBackground } from "~/components/react/noise-background" +import { ClientRouter } from "astro:transitions" import { getLangFromUrl } from "~/i18n/utils" +import Head from "~/components/astro/head/root.astro" const lang = getLangFromUrl(Astro.url) -const config = lang === "zh" ? zh.meta : en.meta --- - - - - - {config.title} - {config.slogan} - - + +
- +