Spaces:
Running
Running
File size: 631 Bytes
424a8d9 | 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 | import { useState } from "react";
export default function MessageInput({ onSend }) {
const [input, setInput] = useState("");
const handleSend = () => {
if (!input.trim()) return;
onSend(input);
setInput("");
};
return (
<div style={{ display: "flex", gap: "10px" }}>
<input
type="text"
value={input}
onChange={(e) => setInput(e.target.value)}
placeholder="Type your message..."
style={{ flex: 1, padding: "10px", fontSize: "16px" }}
/>
<button onClick={handleSend} style={{ padding: "10px 20px" }}>
Send
</button>
</div>
);
}
|