Skip to content

Commit

Permalink
Delete redundant elements in the SearchBar
Browse files Browse the repository at this point in the history
  • Loading branch information
grabinskij committed Dec 8, 2024
1 parent cede991 commit 699a10e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
7 changes: 6 additions & 1 deletion server/src/data/bookings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
"petsNumber": 2
}
},
"alreadyBookedDates": []
"alreadyBookedDates": [
{
"startDate": "12/10/2024",
"endDate": "12/13/2024"
}
]
},
{
"id": 2,
Expand Down
21 changes: 21 additions & 0 deletions server/src/data/reservations.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,26 @@
"cleaningFee": 10,
"longStayDiscount": 0
}
},
{
"reservationId": 5,
"productId": 1,
"checkInDate": "12/10/2024",
"checkOutDate": "12/13/2024",
"guestCounts": {
"adults": 2,
"children": 1,
"infants": 1,
"pets": 1
},
"totalPrice": 458,
"breakdown": {
"nights": 3,
"pricePerNight": 146,
"basePrice": 438,
"airbnbServiceFee": 10,
"cleaningFee": 10,
"longStayDiscount": 0
}
}
]
19 changes: 3 additions & 16 deletions src/components/SearchBar/SearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const SearchBar = ({ searchType, onSearch }) => {
const [showCalendar, setShowCalendar] = useState(false);
const [showWhoDropdown, setShowWhoDropdown] = useState(false);
const [closing, setClosing] = useState(false);
// const [handelGuestsPopUp, setHandelGuestsPopUp] = useState(false);
const [handelDestinationPopUp, setHandelDestinationPopUp] = useState(false);
const [hoverStates, setHoverStates] = useState({
location: false,
Expand Down Expand Up @@ -124,15 +123,10 @@ const SearchBar = ({ searchType, onSearch }) => {
}

const closeCalendarPopup = () => setShowCalendar(false)
const closeDestinationPopup = () => setHandelDestinationPopUp(false) //
// const closeGuestPopup = () => setHandelGuestsPopUp(false)

// const searchBarRef = useOutsideClick(disableSearchBarFocus);
// const calendarRef = useOutsideClick(closeCalendarPopup)
const destinationRef = useOutsideClick(closeDestinationPopup)
// const guestRef = useOutsideClick(closeGuestPopup)
const closeDestinationPopup = () => setHandelDestinationPopUp(false)
const closeWhoDropdown = () => setShowWhoDropdown(false)

const destinationRef = useOutsideClick(closeDestinationPopup)
const searchBarRef = useOutsideClick(disableSearchBarFocus);
const calendarRef = useOutsideClick(closeCalendarPopup)
const whoRef = useOutsideClick(closeWhoDropdown)
Expand Down Expand Up @@ -223,9 +217,7 @@ const SearchBar = ({ searchType, onSearch }) => {

onSearch(searchParams);
};
// const handelWhoPopup = () => {
// setHandelGuestsPopUp(!handelGuestsPopUp);
// }

const handelDestinationClick = () =>{
setHandelDestinationPopUp(!handelDestinationPopUp);
}
Expand Down Expand Up @@ -505,11 +497,6 @@ const SearchBar = ({ searchType, onSearch }) => {
<FontAwesomeIcon icon={faSearch} />
</button>
</div>
<div>
<button onClick={handleSearch} className={styles.circleButton}>
<FontAwesomeIcon icon={faSearch} />
</button>
</div>
</div>
{showWhoDropdown && (
<div className={`${styles.whoDropdownWrapper} ${closing ? styles.close : styles.open}`}>
Expand Down

0 comments on commit 699a10e

Please sign in to comment.