Spaces:
Build error
Build error
File size: 969 Bytes
f463673 |
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 |
import React, { useState } from 'react';
const InputArea = ({ onSend }) => {
const [inputValue, setInputValue] = useState('');
const handleSend = () => {
if (inputValue.trim()) {
onSend(inputValue);
setInputValue('');
}
};
return (
<div className="flex flex-col sm:flex-row gap-2 mt-6">
<input
type="text"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && handleSend()}
placeholder="مثلاً: برند اپکس بالای 5 میلیون"
className="flex-1 p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-800 font-sans"
/>
<button
onClick={handleSend}
className="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-bold"
>
ارسال
</button>
</div>
);
};
export default InputArea; |