fix(SW-983): Fixed bug with hotel card in map

This commit is contained in:
Pontus Dreij
2024-11-22 17:05:29 +01:00
parent 0a35243d88
commit 333be1379c
7 changed files with 88 additions and 54 deletions

View File

@@ -1,5 +1,6 @@
"use client"
import { useParams } from "next/dist/client/components/navigation"
import { memo, useCallback } from "react"
import { useIntl } from "react-intl"
import { Lang } from "@/constants/languages"
@@ -24,7 +25,7 @@ import styles from "./hotelCard.module.css"
import { HotelCardListingTypeEnum } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
import type { HotelCardProps } from "@/types/components/hotelReservation/selectHotel/hotelCardProps"
export default function HotelCard({
function HotelCard({
hotel,
type = HotelCardListingTypeEnum.PageListing,
state = "default",
@@ -44,16 +45,17 @@ export default function HotelCard({
state,
})
const handleMouseEnter = () => {
const handleMouseEnter = useCallback(() => {
if (onHotelCardHover) {
onHotelCardHover(hotelData.name)
}
}
const handleMouseLeave = () => {
}, [onHotelCardHover, hotelData.name])
const handleMouseLeave = useCallback(() => {
if (onHotelCardHover) {
onHotelCardHover(null)
}
}
}, [onHotelCardHover])
return (
<article
@@ -137,3 +139,5 @@ export default function HotelCard({
</article>
)
}
export default memo(HotelCard)