Skip to content

Commit 5369fc9

Browse files
authored
🛝 fix: Render Sidebar Text (#6)
Text labels were conditionally mounted/unmounted with collapsed state, causing a visible pop-in. Now text is always in the DOM and clipped via overflow-hidden, sliding smoothly into view as the sidebar widens.
1 parent 3847bef commit 5369fc9

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/components/Sidebar.tsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,11 @@ export function Sidebar({ user, collapsed, onToggle }: t.SidebarProps) {
8383
)}
8484
>
8585
<div className="flex h-14 shrink-0 items-center px-2">
86-
<div
87-
className={cn('flex items-center', collapsed ? 'w-9 justify-center' : 'gap-2.5 px-1.5')}
88-
>
86+
<div className="flex items-center gap-2.5 overflow-hidden px-1.5">
8987
<img src={libreChatLogo} alt="LibreChat" className="h-6 w-6 shrink-0" />
90-
{!collapsed && (
91-
<span className="flex-1 truncate text-sm font-semibold text-(--cui-color-text-default)">
92-
Admin Panel
93-
</span>
94-
)}
88+
<span className="truncate text-sm font-semibold text-(--cui-color-text-default)">
89+
Admin Panel
90+
</span>
9591
</div>
9692
</div>
9793

@@ -105,8 +101,7 @@ export function Sidebar({ user, collapsed, onToggle }: t.SidebarProps) {
105101
aria-label={collapsed ? localize(item.labelKey) : undefined}
106102
title={collapsed ? localize(item.labelKey) : undefined}
107103
className={cn(
108-
'flex h-8 items-center rounded-md text-sm no-underline transition-colors duration-100',
109-
collapsed ? 'w-9 justify-center' : 'gap-2.5 px-2.5',
104+
'flex h-8 items-center gap-2.5 overflow-hidden rounded-md px-2.5 text-sm whitespace-nowrap no-underline transition-colors duration-100',
110105
isActive(item.path)
111106
? 'bg-(--cui-color-background-active) font-medium text-(--cui-color-text-default)'
112107
: 'font-normal text-(--cui-color-text-muted) hover:bg-(--cui-color-background-hover) hover:text-(--cui-color-text-default)',
@@ -115,20 +110,15 @@ export function Sidebar({ user, collapsed, onToggle }: t.SidebarProps) {
115110
<span aria-hidden="true" className="shrink-0">
116111
<Icon name={item.icon} size="sm" />
117112
</span>
118-
{!collapsed && <span className="truncate text-sm">{localize(item.labelKey)}</span>}
113+
<span className="truncate text-sm">{localize(item.labelKey)}</span>
119114
</Link>
120115
))}
121116
</div>
122117
</nav>
123118

124119
{initials && (
125120
<div className="flex shrink-0 items-center border-t border-(--cui-color-stroke-default) px-2 py-3">
126-
<div
127-
className={cn(
128-
'flex items-center',
129-
collapsed ? 'w-9 justify-center' : 'gap-2.5 px-0.5',
130-
)}
131-
>
121+
<div className="flex items-center gap-2.5 overflow-hidden px-0.5">
132122
<Dropdown>
133123
<Dropdown.Trigger>
134124
<button
@@ -171,7 +161,7 @@ export function Sidebar({ user, collapsed, onToggle }: t.SidebarProps) {
171161
</div>
172162
</Dropdown.Content>
173163
</Dropdown>
174-
{!collapsed && user && (
164+
{user && (
175165
<div className="min-w-0 flex-1">
176166
<span className="block truncate text-sm leading-tight font-medium text-(--cui-color-text-default)">
177167
{user.name || ''}

0 commit comments

Comments
 (0)