From 855d8eb7c30c4e4be91c529fbd67af53177feee6 Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 19 Jul 2026 12:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/site.ts | 18 +++++++++--------- src/layouts/BaseLayout.astro | 16 ++++++++++++++-- src/styles/global.css | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/data/site.ts b/src/data/site.ts index 12dad0b..8686a1f 100644 --- a/src/data/site.ts +++ b/src/data/site.ts @@ -34,15 +34,15 @@ export const contactLinks = [ ]; export const navItems = [ - { label: "首页", href: "/" }, - { label: "三年时间线", href: "/timeline/" }, - { label: "照片墙", href: "/gallery/" }, - { label: "青春刊物", href: "/articles/" }, - { label: "如今的我们", href: "/people/" }, - { label: "班级地图", href: "/map/" }, - { label: "综合试卷", href: "/exam/" }, - { label: "留言墙", href: "/messages/" }, - { label: "搜索", href: "/search/" } + { label: "首页", href: "/", icon: "fa-solid fa-house" }, + { label: "三年时间线", href: "/timeline/", icon: "fa-solid fa-timeline" }, + { label: "照片墙", href: "/gallery/", icon: "fa-solid fa-images" }, + { label: "青春刊物", href: "/articles/", icon: "fa-solid fa-book-open" }, + { label: "如今的我们", href: "/people/", icon: "fa-solid fa-user-group" }, + { label: "班级地图", href: "/map/", icon: "fa-solid fa-map-location-dot" }, + { label: "综合试卷", href: "/exam/", icon: "fa-solid fa-file-pen" }, + { label: "留言墙", href: "/messages/", icon: "fa-solid fa-comments" }, + { label: "搜索", href: "/search/", icon: "fa-solid fa-magnifying-glass", iconOnly: true } ]; const leavingCampusDate = "2024-06-08"; diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 1c3b039..21a8f0b 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -69,7 +69,19 @@ const buildTime = new Intl.DateTimeFormat("zh-CN", { @@ -123,7 +135,7 @@ const buildTime = new Intl.DateTimeFormat("zh-CN", { }); nav.addEventListener("click", (event) => { - if (event.target instanceof HTMLAnchorElement) { + if (event.target instanceof Element && event.target.closest("a")) { closeMenu(); } }); diff --git a/src/styles/global.css b/src/styles/global.css index 45a0fb3..6f1d277 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -100,9 +100,24 @@ a { } .nav a { + display: inline-flex; + align-items: center; + gap: 0.45em; opacity: 0.88; } +.nav-item-icon { + width: 1.15em; + flex: 0 0 auto; + text-align: center; +} + +.nav a.nav-icon-only { + justify-content: center; + min-width: 2.25rem; + padding-inline: 0.6rem; +} + .hero { min-height: 92vh; position: relative;