From 909b03ea286b45c62184f944b2cf1f7cabe6615a Mon Sep 17 00:00:00 2001
From: Mayne
Date: Thu, 8 Oct 2026 21:15:50 +0800
Subject: [PATCH] fix: share language menu between marketplace header and
footer
---
src/components/Footer.astro | 19 +++----------
src/components/LanguageMenu.astro | 45 +++++++++++++++++++++++++++++++
src/layouts/Layout.astro | 15 ++---------
src/styles/global.css | 30 +++------------------
4 files changed, 54 insertions(+), 55 deletions(-)
create mode 100644 src/components/LanguageMenu.astro
diff --git a/src/components/Footer.astro b/src/components/Footer.astro
index bbaa51a..2ceec76 100644
--- a/src/components/Footer.astro
+++ b/src/components/Footer.astro
@@ -1,7 +1,8 @@
---
import type { Locale } from "../i18n";
-import { footerMessages, messages } from "../i18n";
+import { footerMessages } from "../i18n";
import EidosMark from "./EidosMark.astro";
+import LanguageMenu from "./LanguageMenu.astro";
interface Props {
locale: Locale;
@@ -11,7 +12,6 @@ interface Props {
const { locale, englishPath, chinesePath } = Astro.props;
const t = footerMessages[locale];
-const languageLabel = messages[locale].language;
const mainUrl = (path: string) => `https://eidos.space${locale === "zh" ? "/zh" : ""}${path}`;
const docsUrl = (path: string) => `https://docs.eidos.space${locale === "zh" ? "/zh-cn" : ""}${path}`;
@@ -93,20 +93,7 @@ const groups = [
·
{t.fileOwnership}
-
+
diff --git a/src/components/LanguageMenu.astro b/src/components/LanguageMenu.astro
new file mode 100644
index 0000000..d829c6b
--- /dev/null
+++ b/src/components/LanguageMenu.astro
@@ -0,0 +1,45 @@
+---
+import type { Locale } from "../i18n";
+import { messages } from "../i18n";
+
+interface Props {
+ locale: Locale;
+ englishPath: string;
+ chinesePath: string;
+ placement?: "above" | "below";
+}
+const { locale, englishPath, chinesePath, placement = "below" } = Astro.props;
+const label = messages[locale].language;
+---
+
+
+
+
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index d20abed..5a55925 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -3,6 +3,7 @@ import type { Locale } from "../i18n";
import { messages } from "../i18n";
import EidosMark from "../components/EidosMark.astro";
import Footer from "../components/Footer.astro";
+import LanguageMenu from "../components/LanguageMenu.astro";
import "../styles/global.css";
interface Props {
@@ -75,19 +76,7 @@ const themesUrl = isZh ? "/zh/themes" : "/themes";
diff --git a/src/styles/global.css b/src/styles/global.css
index e1fa891..32fd3c9 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -130,28 +130,17 @@ summary:focus-visible {
gap: clamp(16px, 3vw, 34px);
}
-.site-header-actions a {
+.site-header-actions > a {
padding-block: 11px;
color: var(--ink-muted);
font-size: 0.76rem;
transition: color 160ms ease;
}
-.site-header-actions a:hover { color: var(--accent); }
-.site-header-actions a:nth-child(2) { color: var(--accent-hover); font-weight: 650; }
-.site-header-actions a:nth-child(2):hover { color: var(--ink); }
+.site-header-actions > a:hover { color: var(--accent); }
+.site-header-actions > a:nth-child(2) { color: var(--accent-hover); font-weight: 650; }
+.site-header-actions > a:nth-child(2):hover { color: var(--ink); }
-.language-menu { position: relative; }
-.language-menu summary { display: flex; min-width: 42px; min-height: 42px; align-items: center; justify-content: center; gap: 3px; border-radius: 8px; color: var(--ink-muted); cursor: pointer; list-style: none; }
-.language-menu summary::-webkit-details-marker { display: none; }
-.language-menu summary:hover,
-.language-menu[open] summary { background: var(--soft); color: var(--ink); }
-.language-menu summary svg { width: 18px; height: 18px; }
-.language-menu summary span { margin-top: -5px; font-size: 0.95rem; }
-.language-options { position: absolute; top: calc(100% + 8px); right: 0; display: grid; min-width: 155px; padding: 6px; border-radius: 10px; background: var(--surface); box-shadow: 0 12px 32px oklch(0.16 0.012 230 / 12%); }
-.site-header .language-options a { display: flex; min-height: 36px; align-items: center; padding: 7px 11px; border-radius: 7px; color: var(--ink); font-size: 0.78rem; white-space: nowrap; }
-.site-header .language-options a:hover { background: var(--soft); }
-.site-header .language-options a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.market-hero {
overflow: hidden;
@@ -481,16 +470,6 @@ summary:focus-visible {
.site-footer-motto a { text-decoration: underline; text-decoration-color: rgb(0 0 0 / 25%); text-underline-offset: 4px; }
.site-footer-motto a:hover { color: #1d1d1f; text-decoration-color: rgb(0 0 0 / 60%); }
.site-footer-motto a span { margin-left: 4px; }
-.site-footer-language { position: relative; justify-self: end; }
-.site-footer-language summary { display: inline-flex; min-height: 32px; align-items: center; gap: 6px; color: rgb(0 0 0 / 60%); cursor: pointer; list-style: none; }
-.site-footer-language summary::-webkit-details-marker { display: none; }
-.site-footer-language summary svg { width: 14px; height: 14px; }
-.site-footer-language[open] summary,
-.site-footer-language summary:hover { color: #1d1d1f; }
-.site-footer-language-options { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 30; display: grid; min-width: 130px; background: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / 12%); }
-.site-footer-language-options a { display: flex; min-height: 40px; align-items: center; padding-inline: 12px; color: rgb(0 0 0 / 60%); font-size: 0.625rem; letter-spacing: 0.1em; text-transform: none; }
-.site-footer-language-options a:hover { background: var(--soft); color: var(--ink); }
-.site-footer-language-options a[aria-current="page"] { color: #1d1d1f; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; margin: -1px; padding: 0; border: 0; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@@ -512,7 +491,6 @@ summary:focus-visible {
.site-footer-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
.site-footer-bottom { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.site-footer-motto { text-align: left; }
- .site-footer-language { justify-self: start; }
}
@media (max-width: 620px) {