Skip to content

Commit 7b74f11

Browse files
committed
fix(UserMenu): 下拉面板改用显式颜色,修复看不清的问题
之前用 bg-popover / text-foreground / bg-muted 等语义色 token, 在当前主题下 popover 色与 background 几乎同色(白-近白 / 黑-近黑), 面板看起来像透明的悬浮,文字勉强可辨。 改为显式 neutral 色阶: - 容器:bg-white dark:bg-neutral-900 - 边框:border-neutral-200 dark:border-neutral-700 - 账号信息区:bg-neutral-50 dark:bg-neutral-800 做背景分层 - 文字:text-neutral-900 dark:text-neutral-100 - hover:bg-neutral-100 dark:bg-neutral-800 - 登出按钮加 border-t 与上面其它选项分隔 阴影从 shadow-lg 升到 shadow-xl 让浮层从下方内容里跳出来。
1 parent 9ccdb9c commit 7b74f11

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

app/components/UserMenu.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,22 @@ export function UserMenu({ user, provider, logout }: UserMenuProps) {
3737
</Avatar>
3838
</summary>
3939

40-
<div className="absolute right-0 mt-2 w-60 overflow-hidden rounded-md border border-border bg-popover shadow-lg z-50">
41-
<div className="border-b border-border bg-muted/40 px-4 py-3">
42-
<p className="text-sm font-medium text-foreground">
40+
{/*
41+
下拉面板用显式的 bg-white / dark:bg-neutral-900 避免依赖 bg-popover
42+
CSS 变量(原色值在某些主题下与 background 几乎同色导致看不清)。
43+
每一项都显式 text-neutral-900 / dark:text-neutral-100 确保文字可读。
44+
*/}
45+
<div className="absolute right-0 mt-2 w-60 overflow-hidden rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 shadow-xl z-50">
46+
{/* 账号信息区 */}
47+
<div className="border-b border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800 px-4 py-3">
48+
<p className="text-sm font-medium text-neutral-900 dark:text-neutral-100">
4349
{user.name ?? "Signed in"}
4450
</p>
4551
{user.email ? (
46-
<p className="text-xs text-muted-foreground" title={user.email}>
52+
<p
53+
className="text-xs text-neutral-500 dark:text-neutral-400"
54+
title={user.email}
55+
>
4756
{user.email}
4857
</p>
4958
) : null}
@@ -52,7 +61,7 @@ export function UserMenu({ user, provider, logout }: UserMenuProps) {
5261
{/* 设置入口:登录用户均可见,指向 /settings 偏好页 */}
5362
<Link
5463
href="/settings"
55-
className="block px-4 py-2 text-sm text-foreground transition hover:bg-muted"
64+
className="block px-4 py-2 text-sm text-neutral-900 dark:text-neutral-100 transition hover:bg-neutral-100 dark:hover:bg-neutral-800"
5665
data-umami-event="user_menu_settings_click"
5766
>
5867
设置
@@ -63,15 +72,15 @@ export function UserMenu({ user, provider, logout }: UserMenuProps) {
6372
href="https://github.com/logout"
6473
target="_blank"
6574
rel="noreferrer"
66-
className="block px-4 py-2 text-sm text-foreground transition hover:bg-muted"
75+
className="block px-4 py-2 text-sm text-neutral-900 dark:text-neutral-100 transition hover:bg-neutral-100 dark:hover:bg-neutral-800"
6776
>
6877
切换 GitHub 账号(将在新标签页登出 GitHub)
6978
</a>
7079
) : null}
7180

7281
<button
7382
onClick={() => void logout()}
74-
className="w-full px-4 py-2 text-left text-sm text-foreground transition hover:bg-muted"
83+
className="w-full px-4 py-2 text-left text-sm text-neutral-900 dark:text-neutral-100 transition hover:bg-neutral-100 dark:hover:bg-neutral-800 border-t border-neutral-200 dark:border-neutral-700"
7584
>
7685
Sign out
7786
</button>

0 commit comments

Comments
 (0)