import { useState } from 'react' import '../styles/chatinput.css' // Make sure file is named exactly like this function ChatInput({ onSend }: { onSend: (msg: string) => void }) { const [input, setInput] = useState('') const handleKey = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && input.trim()) { onSend(input) setInput('') } } return (
setInput(e.target.value)} onKeyDown={handleKey} />
) function handleSend() { if (input.trim()) { onSend(input) setInput('') } } } export default ChatInput