-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtt.txt
More file actions
66 lines (60 loc) · 1.8 KB
/
Copy pathtt.txt
File metadata and controls
66 lines (60 loc) · 1.8 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function Search({ setQuery, query }) {
const [searchTerm, setSearchTerm] = useState(query);
const handleKeyDown = (e) => {
if (e.key === "Enter") {
setQuery(searchTerm);
}
};
return (
<>
<div className="flex">
<input
type="search"
placeholder="Search Anything..."
className="w-full px-5 py-5 border bg-gray-50 hover:border-red-500 hover:bg-slate-100 focus:border-blue-500 focus:outline-none"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
onKeyDown={handleKeyDown}
></input>
<button
className="bg-blue-600 px-6 py-2.5 text-white rounded-tr rounded-br focus:ring-2 focus:ring-blue-300 disabled:bg-gray-400"
onClick={() => {
setQuery(searchTerm);
}}
>
Search
</button>
</div>
</>
);
}
function Search({ setQuery, query }) {
// const [searchTerm, setSearchTerm] = useState(query);
// const handleKeyDown = (e) => {
// if (e.key === "Enter") {
// setQuery(searchTerm);
// }
// };
return (
<>
<div className="flex">
<input
type="search"
placeholder="Search Anything..."
className="w-full px-5 py-5 border bg-gray-50 hover:border-red-500 hover:bg-slate-100 focus:border-blue-500 focus:outline-none"
value={query}
onChange={(e) => setQuery(e.target.value)}
// onKeyDown={handleKeyDown}
></input>
<button
className="bg-blue-600 px-6 py-2.5 text-white rounded-tr rounded-br focus:ring-2 focus:ring-blue-300 disabled:bg-gray-400"
onClick={() => {
setQuery(searchTerm);
}}
>
Search
</button>
</div>
</>
);
}