Skip to content

Commit 8e1da0d

Browse files
committed
样式优化
1 parent 7592c85 commit 8e1da0d

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

src/view/chat/components/sidebar/Sidebar.tsx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -195,34 +195,41 @@ const Sidebar: React.FC = () => {
195195

196196
return (
197197
<div className="h-full flex flex-col">
198-
<div className="p-4 border-b flex items-center justify-between">
199-
<input
200-
type="text"
201-
placeholder="搜索聊天..."
202-
className="w-full px-4 py-2 rounded-lg bg-gray-100 focus:outline-none"
203-
disabled={isConnecting}
204-
/>
205-
{userName && (
206-
<div className="ml-2 text-sm text-gray-500 flex items-center">
207-
<span className="mr-1">用户:</span>
208-
<span className="font-medium text-blue-500">{userName}</span>
209-
<button
210-
onClick={() => {
211-
setTempUserName(userName);
212-
setNameDialogOpen(true);
213-
}}
214-
className="ml-1 p-1 text-gray-400 hover:text-gray-600"
215-
title="修改用户名"
216-
disabled={isConnecting}
217-
>
218-
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
219-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
220-
d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
221-
/>
222-
</svg>
223-
</button>
224-
</div>
225-
)}
198+
<div className="p-4 border-b">
199+
<div className="flex flex-col space-y-3">
200+
<input
201+
type="text"
202+
placeholder="搜索聊天..."
203+
className="w-full px-4 py-2 rounded-lg bg-gray-100 focus:outline-none"
204+
disabled={isConnecting}
205+
/>
206+
207+
{userName && (
208+
<div className="flex items-center justify-between bg-blue-50 px-3 py-2 rounded-lg">
209+
<div className="flex items-center">
210+
<div className="w-6 h-6 rounded-full bg-blue-500 flex items-center justify-center text-white text-xs">
211+
{userName.charAt(0).toUpperCase()}
212+
</div>
213+
<span className="ml-2 font-medium text-blue-700 truncate max-w-[120px]">{userName}</span>
214+
</div>
215+
<button
216+
onClick={() => {
217+
setTempUserName(userName);
218+
setNameDialogOpen(true);
219+
}}
220+
className="p-1 text-blue-400 hover:text-blue-600 rounded-full hover:bg-blue-100"
221+
title="修改用户名"
222+
disabled={isConnecting}
223+
>
224+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
225+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
226+
d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
227+
/>
228+
</svg>
229+
</button>
230+
</div>
231+
)}
232+
</div>
226233
</div>
227234

228235
<div className="flex-1 overflow-y-auto">

0 commit comments

Comments
 (0)