durukan commited on
Commit
a875d67
·
verified ·
1 Parent(s): bc874d5

Upload components/ChatMessage.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/ChatMessage.jsx +14 -0
components/ChatMessage.jsx ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { format } from 'date-fns';
2
+
3
+ export default function ChatMessage({ message, isUser }) {
4
+ return (
5
+ <div className={`flex ${isUser ? 'justify-end' : 'justify-start'} mb-4`}>
6
+ <div className={`max-w-xs md:max-w-md lg:max-w-lg xl:max-w-xl rounded-lg p-3 ${isUser ? 'bg-primary text-white rounded-br-none' : 'bg-gray-100 text-gray-800 rounded-bl-none'}`}>
7
+ <p className="mb-1">{message.text}</p>
8
+ <p className="text-xs opacity-70 text-right">
9
+ {format(new Date(message.timestamp), 'h:mm a')}
10
+ </p>
11
+ </div>
12
+ </div>
13
+ );
14
+ }