Spaces:
Running

File size: 1,540 Bytes
526e04d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use client'

import { Bot } from 'lucide-react'
import { motion, AnimatePresence } from 'framer-motion'

interface TypingIndicatorProps {
    isVisible: boolean
}

export function TypingIndicator({ isVisible }: TypingIndicatorProps) {
    return (
        <AnimatePresence>
            {isVisible && (
                <motion.div
                    initial={{ opacity: 0, y: 10 }}
                    animate={{ opacity: 1, y: 0 }}
                    exit={{ opacity: 0, scale: 0.9 }}
                    className="flex w-full max-w-3xl mx-auto justify-end mt-4"
                >
                    <div className="flex gap-3 flex-row-reverse">
                        <div className="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center flex-shrink-0 shadow-sm mt-auto mb-1">
                            <Bot className="w-4 h-4" />
                        </div>
                        <div className="bg-indigo-600 text-white px-4 py-3 rounded-2xl rounded-br-none shadow-sm flex items-center gap-1">
                            <span className="w-1.5 h-1.5 bg-white/70 rounded-full animate-bounce [animation-delay:-0.3s]"></span>
                            <span className="w-1.5 h-1.5 bg-white/70 rounded-full animate-bounce [animation-delay:-0.15s]"></span>
                            <span className="w-1.5 h-1.5 bg-white/70 rounded-full animate-bounce"></span>
                        </div>
                    </div>
                </motion.div>
            )}
        </AnimatePresence>
    )
}