This repository was archived by the owner on Feb 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 753
Expand file tree
/
Copy pathSearch.js
More file actions
45 lines (39 loc) · 1.17 KB
/
Search.js
File metadata and controls
45 lines (39 loc) · 1.17 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
import React, {useState} from "react";
import SearchButton from "./components/SearchButton";
const Search = ({search}) => {
const [searchInput, setSearchInput] = useState("");
function handleSearchInput(event) {
setSearchInput(event.target.value);
console.log(event.target.value);
}
function submitHandler(event) {
event.preventDefault();
search(searchInput);
}
return (
<div className="search">
<div className="page-header">
<h4 className="text-left">Search Bookings</h4>
</div>
<div className="row search-wrapper">
<div className="col">
<form onSubmit={submitHandler} className="form-group search-box">
<label htmlFor="customerName">Customer name</label>
<div className="search-row">
<input
onChange={handleSearchInput}
value={searchInput}
type="text"
id="customerName"
className="form-control"
placeholder="Customer name"
/>
<SearchButton />
</div>
</form>
</div>
</div>
</div>
);
};
export default Search;