Skip to content

Commit

Permalink
create message component
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshidwivedi committed Jun 27, 2024
1 parent 4494bc7 commit 95278dc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/room/components/chat/Message.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {socket} from "@/common/lib/socket";

const Message = ({ userId, msg, username, color}: Message) =>{
const me= socket.id===userId;
return (
<div
className={`my-2 flex gap-2 text-clip ${me && "justify-end text-right"}`}
>
{!me && (
<h5 style={{color}} className="font-bold">{username}</h5>
)}
<p style={{wordBreak: "break-all"}}>{msg}</p>
</div>
);
};
export default Message;

0 comments on commit 95278dc

Please sign in to comment.