Redesign sidebar user section to fix overlap issue
Restructured layout: avatar, truncated username, and logout icon in a single row. Collapsed state stacks vertically. Logout button uses a subtle icon-only style with red hover. Proper text ellipsis prevents name overflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,84 @@ tr:hover {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Sidebar User Section */
|
||||
.sidebar-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 14px;
|
||||
margin: 8px;
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
||||
.sidebar-user-collapsed {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px 4px;
|
||||
margin: 8px 4px;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.08));
|
||||
border: 1px solid rgba(56, 189, 248, 0.15);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.avatar-initials {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--accent);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
.logout-btn-collapsed {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
transform: translateX(-100%);
|
||||
|
||||
@@ -130,8 +130,9 @@ pub fn Sidebar() -> Element {
|
||||
let auth_info = use_context::<Signal<AuthInfo>>();
|
||||
let info = auth_info();
|
||||
let initials = info.name.chars().next().unwrap_or('U').to_uppercase().to_string();
|
||||
let user_class = if collapsed() { "sidebar-user sidebar-user-collapsed" } else { "sidebar-user" };
|
||||
rsx! {
|
||||
div { class: "sidebar-user",
|
||||
div { class: "{user_class}",
|
||||
div { class: "user-avatar",
|
||||
if info.avatar_url.is_empty() {
|
||||
span { class: "avatar-initials", "{initials}" }
|
||||
@@ -140,15 +141,13 @@ pub fn Sidebar() -> Element {
|
||||
}
|
||||
}
|
||||
if !collapsed() {
|
||||
div { class: "user-info",
|
||||
span { class: "user-name", "{info.name}" }
|
||||
a {
|
||||
href: "/logout",
|
||||
class: "logout-link",
|
||||
Icon { icon: BsBoxArrowRight, width: 14, height: 14 }
|
||||
" Logout"
|
||||
}
|
||||
}
|
||||
span { class: "user-name", "{info.name}" }
|
||||
}
|
||||
a {
|
||||
href: "/logout",
|
||||
class: if collapsed() { "logout-btn logout-btn-collapsed" } else { "logout-btn" },
|
||||
title: "Sign out",
|
||||
Icon { icon: BsBoxArrowRight, width: 16, height: 16 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user