Merged in feat/SW-1549-map-improvements (pull request #1783)
Feat/SW-1549 map improvements * fix: imported new icon * refactor: rename component and set map handling to 'greedy' * fix: show cards for 3s after hover * refactor: update styles and added HotelPin component * fix: change from close to back icon * refactor: update to only use 1 state value for active pin and card * fix: add click handler when dialog is opened * fix: performance fixes for the dialog carousel * fix: added border * fix: clear timeout on mouseenter * fix: changed to absolute import * fix: moved hover state into the store * fix: renamed store actions Approved-by: Michael Zetterberg
This commit is contained in:
@@ -13,22 +13,19 @@ import { HotelCardListingTypeEnum } from "@/types/components/hotelReservation/se
|
||||
import type { HotelListingProps } from "@/types/components/hotelReservation/selectHotel/map"
|
||||
|
||||
export default function HotelListing({ hotels }: HotelListingProps) {
|
||||
const { activeHotelPin } = useHotelsMapStore()
|
||||
const { activeHotel } = useHotelsMapStore()
|
||||
const isMobile = useMediaQuery("(max-width: 767px)")
|
||||
return (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<div className={styles.hotelListingMobile} data-open={!!activeHotelPin}>
|
||||
<HotelCardDialogListing hotels={hotels} />
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.hotelListing}>
|
||||
<HotelCardListing
|
||||
hotelData={hotels}
|
||||
type={HotelCardListingTypeEnum.MapListing}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
return isMobile ? (
|
||||
<div className={styles.hotelListingMobile} data-open={!!activeHotel}>
|
||||
<HotelCardDialogListing hotels={hotels} />
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.hotelListing}>
|
||||
<HotelCardListing
|
||||
hotelData={hotels}
|
||||
type={HotelCardListingTypeEnum.MapListing}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function SelectHotelContent({
|
||||
const listingContainerRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
const activeFilters = useHotelFilterStore((state) => state.activeFilters)
|
||||
const { activeHotelPin } = useHotelsMapStore()
|
||||
const { activeHotel } = useHotelsMapStore()
|
||||
|
||||
const { showBackToTop, scrollToTop } = useScrollToTop({
|
||||
threshold: 490,
|
||||
@@ -65,8 +65,8 @@ export default function SelectHotelContent({
|
||||
)
|
||||
|
||||
const coordinates = useMemo(() => {
|
||||
if (activeHotelPin) {
|
||||
const hotel = hotels.find((hotel) => hotel.hotel.name === activeHotelPin)
|
||||
if (activeHotel) {
|
||||
const hotel = hotels.find((hotel) => hotel.hotel.name === activeHotel)
|
||||
|
||||
if (hotel && hotel.hotel.location) {
|
||||
return {
|
||||
@@ -79,7 +79,7 @@ export default function SelectHotelContent({
|
||||
return isAboveMobile
|
||||
? cityCoordinates
|
||||
: { ...cityCoordinates, lat: cityCoordinates.lat - 0.006 }
|
||||
}, [activeHotelPin, hotels, isAboveMobile, cityCoordinates])
|
||||
}, [activeHotel, hotels, isAboveMobile, cityCoordinates])
|
||||
|
||||
const filteredHotelPins = useMemo(() => {
|
||||
const updatedHotelsList = bookingCode
|
||||
@@ -159,14 +159,15 @@ export default function SelectHotelContent({
|
||||
<div className={styles.filterContainer}>
|
||||
<Button
|
||||
intent="text"
|
||||
size="small"
|
||||
type="button"
|
||||
variant="icon"
|
||||
wrapping
|
||||
size="small"
|
||||
className={styles.filterContainerCloseButton}
|
||||
asChild
|
||||
>
|
||||
<Link href={selectHotel(lang)} keepSearchParams>
|
||||
<MaterialIcon icon="close" color="CurrentColor" />
|
||||
<MaterialIcon icon="arrow_back" color="CurrentColor" size={20} />
|
||||
{intl.formatMessage({ id: "Back" })}
|
||||
</Link>
|
||||
</Button>
|
||||
<FilterAndSortModal
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.filterContainerCloseButton {
|
||||
color: var(--Component-Button-Brand-Secondary-On-fill-Default);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.container .closeButton {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user