fix(footer): 联系我们图标与首行文字同中线

旧写法用固定 mt-0.5 给图标手拍偏移,而本项目 --line-height-relaxed 是 1.85(非 Tailwind
默认 1.625),根字号又有 16/17/18 三档 ⇒ 图标中心比文字行盒中心高 3.319/3.134/2.950px
(地址行)与 3.313/3.133/2.945px(邮箱行)。

改为结构对齐:地址行图标包进高 = 行盒高(--line-height-relaxed × --font-size-sm)的
items-center 单元格,换行后仍对齐首行;邮箱行是单行链接,整行 items-center。
行高/字号/页高零变化,只移动两个图标。
This commit is contained in:
zhangxiang committed 2026-10-26 10:43:57 +08:00
1 parent 03be1c9e36
commit a63cf38c62
10 files changed
+690 -3

No files matched your search

+13 -3
View File
@@ -71,11 +71,21 @@ export function Footer() {
<div className="font-semibold text-sm mb-5 text-dark-text-primary tracking-widest uppercase">联系我们</div>
<ul className="space-y-4 mb-8 [&_li]:p-0 [&_li]:m-0 [&_li]:static [&_li::before]:hidden">
<li className="flex items-start gap-3">
<MapPin className="w-4 h-4 text-dark-text-muted mt-0.5 shrink-0" />
{/* 图标与首行文字共用一个行盒:高 = --line-height-relaxed × --font-size-sm
(本项目把 relaxed 重映射成 1.85,不是 Tailwind 默认的 1.625),图标在其中
items-center。旧写法是固定 mt-0.5 手拍,在三档根字号下都比文字中线高
3.319 / 3.134 / 2.950px(root 18/17/16,见 e2e/footer-contact-align.spec.ts)。
高度用令牌而非裸 px:地址换行时仍对齐首行,且随根字号等比。 */}
<span className="h-[calc(var(--line-height-relaxed)*var(--font-size-sm))] flex w-4 shrink-0 items-center justify-center">
<MapPin className="w-4 h-4 text-dark-text-muted" />
</span>
<span className="text-dark-text-secondary text-sm leading-relaxed">{config.address}</span>
</li>
<li className="flex items-start gap-3">
<Mail className="w-4 h-4 text-dark-text-muted mt-0.5 shrink-0" />
<li className="flex items-center gap-3">
{/* 邮箱是单行链接(无断行点):行高由 globals.css:637-639 的 ul 规则继承为
--line-height-relaxed,整行 items-center 就让图标与链接盒中心同高,
不需要上面那种行盒常量。若日后换成可断行的长文本,改回行盒写法。 */}
<Mail className="w-4 h-4 text-dark-text-muted shrink-0" />
<a
href={`mailto:${config.email}`}
className="text-dark-text-secondary hover:text-dark-text-primary transition-colors duration-200 text-sm"