Spaces:
Build error
Build error
Create MessageBubble.tsx
Browse files
frontend/src/components/ai-tutor/MessageBubble.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
const MessageBubble = ({ content, role, timestamp }) => (
|
| 4 |
+
<div className={`flex ${role === 'user' ? 'justify-end' : 'justify-start'} mb-4`}>
|
| 5 |
+
<div className={`max-w-[80%] rounded-lg p-4 ${
|
| 6 |
+
role === 'user'
|
| 7 |
+
? 'bg-blue-500 text-white'
|
| 8 |
+
: 'bg-gray-100 text-gray-900'
|
| 9 |
+
}`}>
|
| 10 |
+
<div className="text-sm">{content}</div>
|
| 11 |
+
<div className="text-xs mt-1 opacity-70">
|
| 12 |
+
{new Date(timestamp).toLocaleTimeString()}
|
| 13 |
+
</div>
|
| 14 |
+
</div>
|
| 15 |
+
</div>
|
| 16 |
+
);
|
| 17 |
+
|
| 18 |
+
export default MessageBubble;
|