mohammadSaber26 commited on
Commit
f463673
·
verified ·
1 Parent(s): e9a9bff

Upload components/InputArea.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/InputArea.jsx +33 -0
components/InputArea.jsx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from 'react';
2
+
3
+ const InputArea = ({ onSend }) => {
4
+ const [inputValue, setInputValue] = useState('');
5
+
6
+ const handleSend = () => {
7
+ if (inputValue.trim()) {
8
+ onSend(inputValue);
9
+ setInputValue('');
10
+ }
11
+ };
12
+
13
+ return (
14
+ <div className="flex flex-col sm:flex-row gap-2 mt-6">
15
+ <input
16
+ type="text"
17
+ value={inputValue}
18
+ onChange={(e) => setInputValue(e.target.value)}
19
+ onKeyPress={(e) => e.key === 'Enter' && handleSend()}
20
+ placeholder="مثلاً: برند اپکس بالای 5 میلیون"
21
+ 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"
22
+ />
23
+ <button
24
+ onClick={handleSend}
25
+ className="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-bold"
26
+ >
27
+ ارسال
28
+ </button>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default InputArea;