add images for chatting room title

This commit is contained in:
2026-07-09 15:34:04 +09:00
parent 97a780f661
commit ab40abf5b3
+3 -2
View File
@@ -222,7 +222,7 @@ function ThreadCard({ thread, onOpen }: { thread: InstructorChatThread; onOpen:
);
}
function StudentAvatar({ thread }: { thread: InstructorChatThread }) {
function StudentAvatar({ thread, size = 'md' }: { thread: InstructorChatThread; size?: 'sm' | 'md' }) {
const [avatarFailed, setAvatarFailed] = useState(false);
useEffect(() => {
@@ -230,7 +230,7 @@ function StudentAvatar({ thread }: { thread: InstructorChatThread }) {
}, [thread.studentAvatarUrl]);
return (
<span className="grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-full bg-[#eef2ff] text-[#4f46e5] transition group-hover:bg-[#4f46e5] group-hover:text-white">
<span className={`${size === 'sm' ? 'h-9 w-9' : 'h-10 w-10'} grid shrink-0 place-items-center overflow-hidden rounded-full bg-[#eef2ff] text-[#4f46e5] transition group-hover:bg-[#4f46e5] group-hover:text-white`}>
{thread.studentAvatarUrl && !avatarFailed ? (
<img className="h-full w-full object-cover" src={thread.studentAvatarUrl} alt="" onError={() => setAvatarFailed(true)} />
) : (
@@ -291,6 +291,7 @@ function ChatRoom({
<button className="grid h-9 w-9 place-items-center rounded-md text-[#64748b] hover:bg-[#f8fafc] hover:text-[#111827]" type="button" aria-label="목록으로 돌아가기" title="목록으로 돌아가기" onClick={onBack}>
<ArrowLeft size={17} aria-hidden="true" />
</button>
<StudentAvatar thread={thread} size="sm" />
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<p className="truncate text-[15px] font-black text-[#0f172a]">{thread.studentName}</p>