-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from ReDI-School/feature/searchbar
Feature/searchbar
- Loading branch information
Showing
7 changed files
with
237 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* src/components/SearchBar.css */ | ||
.search-bar { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
background-color: white; | ||
padding: 10px; | ||
border-radius: 30px; | ||
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.input-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
position: relative; | ||
width: 160px; | ||
} | ||
|
||
.label { | ||
margin-bottom: 5px; | ||
margin-left: 10px; | ||
margin-top: 5px; | ||
font-size: 12px; | ||
color: #666; | ||
font-weight: bold; | ||
width: 100%; | ||
text-align: left; | ||
padding: 0; | ||
border: none; | ||
} | ||
|
||
.search-bar input { | ||
padding: 5px 0; | ||
border-radius: 0; | ||
border: none; | ||
outline: none; | ||
width: 100%; | ||
background-color: white; | ||
text-indent: 10px; | ||
} | ||
|
||
.separator { | ||
width: 1px; | ||
height: 40px; | ||
background-color: gray; | ||
margin: 0 15px; | ||
} | ||
|
||
.circle-button { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: #ff385c; | ||
color: white; | ||
border: none; | ||
border-radius: 50%; | ||
width: 40px; | ||
height: 40px; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
.circle-button:hover { | ||
background-color: #e7314d; | ||
} | ||
|
||
.circle-button svg { | ||
width: 16px; | ||
height: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { faSearch } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import React, { useState } from "react"; | ||
import "./SearchBar.css"; | ||
|
||
const SearchBar = ({ checkIn: initialCheckIn, checkOut: initialCheckOut, guests: initialGuests, onSearch }) => { | ||
const [location, setLocation] = useState(""); | ||
const [checkIn, setCheckIn] = useState(initialCheckIn || ""); | ||
const [checkOut, setCheckOut] = useState(initialCheckOut || ""); | ||
const [guests, setGuests] = useState(initialGuests || ""); | ||
|
||
const handleSearch = () => { | ||
//search logic here | ||
onSearch({ location, checkIn, checkOut, guests }); | ||
}; | ||
|
||
return ( | ||
<div className="search-bar"> | ||
<div className="input-container"> | ||
<span className="label">Where</span> | ||
<input | ||
type="text" | ||
placeholder="Search destinations" | ||
value={location} | ||
onChange={(e) => setLocation(e.target.value)} | ||
/> | ||
</div> | ||
<div className="separator"></div> | ||
|
||
<div className="input-container"> | ||
<span className="label">Check in</span> | ||
<input | ||
type="text" | ||
placeholder="Add dates" | ||
value={checkIn} | ||
onChange={(e) => setCheckIn(e.target.value)} | ||
/> | ||
</div> | ||
<div className="separator"></div> | ||
|
||
<div className="input-container"> | ||
<span className="label">Check out</span> | ||
<input | ||
type="text" | ||
placeholder="Add dates" | ||
value={checkOut} | ||
onChange={(e) => setCheckOut(e.target.value)} | ||
/> | ||
</div> | ||
<div className="separator"></div> | ||
|
||
<div className="input-container"> | ||
<span className="label">Who</span> | ||
<input | ||
type="text" | ||
placeholder="Add guests" | ||
value={guests} | ||
onChange={(e) => setGuests(e.target.value)} | ||
/> | ||
</div> | ||
<button onClick={handleSearch} className="circle-button"> | ||
<FontAwesomeIcon icon={faSearch} /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters