Merged in feat/SW-2800-lightbox-history-state (pull request #2147)

feat(SW-2800): closing image gallery and lightbox on using browser navigation

* feat(SW-2800): closing image gallery and lightbox on using browser navigation


Approved-by: Linus Flood
This commit is contained in:
Erik Tiekstra
2025-05-19 13:58:20 +00:00
committed by Linus Flood
parent 93a155f1e4
commit 41e09f082a
4 changed files with 26 additions and 12 deletions

View File

@@ -37,10 +37,6 @@ export default function HotelReservationSidePeek() {
room.roomTypes.some((type) => type.code === roomTypeCode)
)
function handleCloseClick() {
window.history.back()
}
useEffect(() => {
if (activeSidePeek) {
window.history.pushState(null, "", window.location.href)
@@ -71,7 +67,7 @@ export default function HotelReservationSidePeek() {
hotel={{ ...hotelData.hotel, url: hotelData.url }}
restaurants={hotelData.restaurants}
activeSidePeek={activeSidePeek}
close={handleCloseClick}
close={closeFn}
showCTA={showCTA}
/>
<AmenitiesSidePeek
@@ -79,7 +75,7 @@ export default function HotelReservationSidePeek() {
restaurants={hotelData.restaurants}
additionalHotelData={hotelData.additionalData}
activeSidePeek={activeSidePeek}
close={handleCloseClick}
close={closeFn}
/>
</>
)}
@@ -87,7 +83,7 @@ export default function HotelReservationSidePeek() {
<RoomSidePeek
room={selectedRoom}
activeSidePeek={activeSidePeek}
close={handleCloseClick}
close={closeFn}
/>
)}
</>