import React, { useState } from 'react'; import { Send } from 'lucide-react'; interface ChatInputProps { onSend: (text: string) => void; disabled?: boolean; } const ChatInput: React.FC = ({ onSend, disabled }) => { const [input, setInput] = useState(''); const handleSend = () => { if (!input.trim() || disabled) return; onSend(input); setInput(''); }; return (
setInput(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && handleSend()} placeholder="Type your response in character..." className="flex-grow px-5 py-3 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-teal-500 bg-white text-slate-900 placeholder:text-slate-400 text-sm shadow-inner" disabled={disabled} />
); }; export default React.memo(ChatInput);