refactor(sidebar): move balance below nickname

This commit is contained in:
小鱼开发
2026-05-22 15:28:43 +08:00
parent 9870a8cbc8
commit 7f43795b2e
2 changed files with 39 additions and 41 deletions
+7 -9
View File
@@ -174,23 +174,21 @@
overflow: hidden;
}
.sidebar-balance {
.sidebar-balance-inline {
display: flex;
align-items: center;
justify-content: center;
gap: var(--spacing-xs);
padding: var(--spacing-xs) var(--spacing-sm);
margin-top: 2px;
cursor: pointer;
transition: background var(--transition-fast);
border-bottom: 1px solid var(--border-light);
transition: opacity var(--transition-fast);
}
.sidebar-balance:hover {
background: var(--bg-hover);
.sidebar-balance-inline:hover {
opacity: 0.8;
}
.sidebar-balance .balance-text {
font-size: var(--font-sm);
.sidebar-balance-inline .balance-text {
font-size: 12px;
font-weight: 600;
color: var(--primary);
}
+32 -32
View File
@@ -211,44 +211,44 @@ export default function Sidebar({ currentPath, onNavigate }: SidebarProps) {
)}
<div className="sidebar-footer" ref={menuRef}>
<div className="sidebar-footer-card">
<div
className="sidebar-balance"
onClick={() => onNavigate('profile')}
title="查看账户"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#36b26a" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
<span className="balance-text">{balance} </span>
</div>
<div
className="sidebar-user"
onClick={() => setShowUserMenu(!showUserMenu)}
title="菜单"
>
<img
src={authUser?.avatar || '/default-avatar.svg'}
alt="avatar"
className="user-avatar"
style={{ objectFit: 'cover' }}
/>
<div className="user-info">
<span className="user-name">{authUser?.nickname || '用户'}</span>
<img
src={authUser?.avatar || '/default-avatar.svg'}
alt="avatar"
className="user-avatar"
style={{ objectFit: 'cover' }}
/>
<div className="user-info">
<span className="user-name">{authUser?.nickname || '用户'}</span>
<div
className="sidebar-balance-inline"
onClick={(e) => { e.stopPropagation(); onNavigate('profile'); }}
title="查看账户"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#36b26a" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
<span className="balance-text">{balance} </span>
</div>
</div>
<svg
className={`user-chevron ${showUserMenu ? 'expanded' : ''}`}
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<polyline points="9 18 15 12 9 6" />
</svg>
</div>
<svg
className={`user-chevron ${showUserMenu ? 'expanded' : ''}`}
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<polyline points="9 18 15 12 9 6" />
</svg>
</div>
</div>
{showUserMenu && (
<div className="user-dropdown-menu">