FrederickSundeep commited on
Commit
2aad597
·
1 Parent(s): dd2ba48

commit 007

Browse files
src/components/ChatBox.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .typing-indicator {
2
+ display: flex;
3
+ gap: 6px;
4
+ padding: 0.5rem 1rem;
5
+ align-items: center;
6
+ }
7
+
8
+ .typing-indicator .dot {
9
+ width: 8px;
10
+ height: 8px;
11
+ background-color: #aaa;
12
+ border-radius: 50%;
13
+ animation: blink 1.4s infinite both;
14
+ }
15
+
16
+ .typing-indicator .dot:nth-child(2) {
17
+ animation-delay: 0.2s;
18
+ }
19
+ .typing-indicator .dot:nth-child(3) {
20
+ animation-delay: 0.4s;
21
+ }
22
+
23
+ @keyframes blink {
24
+ 0%, 80%, 100% {
25
+ opacity: 0;
26
+ }
27
+ 40% {
28
+ opacity: 1;
29
+ }
30
+ }
src/components/ChatBox.jsx CHANGED
@@ -1,6 +1,8 @@
 
1
  import CodeBlock from "./CodeBlock";
 
2
 
3
- export default function ChatBox({ messages }) {
4
  return (
5
  <div className="chat-box">
6
  {messages.map((msg, i) => (
@@ -10,6 +12,17 @@ export default function ChatBox({ messages }) {
10
  </div>
11
  </div>
12
  ))}
 
 
 
 
 
 
 
 
 
 
 
13
  </div>
14
  );
15
  }
 
1
+ import React from "react";
2
  import CodeBlock from "./CodeBlock";
3
+ import "./ChatBox.css"; // Add dot animation CSS
4
 
5
+ export default function ChatBox({ messages, loading }) {
6
  return (
7
  <div className="chat-box">
8
  {messages.map((msg, i) => (
 
12
  </div>
13
  </div>
14
  ))}
15
+
16
+ {/* ✅ Typing indicator when loading */}
17
+ {loading && (
18
+ <div className="message assistant">
19
+ <div className="bubble typing-indicator">
20
+ <span className="dot"></span>
21
+ <span className="dot"></span>
22
+ <span className="dot"></span>
23
+ </div>
24
+ </div>
25
+ )}
26
  </div>
27
  );
28
  }