Merged in fix/SW-983-map-view-cards-hover-select (pull request #971)
Fix/SW-983 map view cards hover select Approved-by: Niclas Edenvin
This commit is contained in:
@@ -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"
|
||||
@@ -25,7 +26,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",
|
||||
@@ -45,16 +46,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
|
||||
@@ -142,3 +144,5 @@ export default function HotelCard({
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(HotelCard)
|
||||
|
||||
Reference in New Issue
Block a user