Files
web/apps/scandic-web/components/HotelReservation/HotelCardDialog/index.tsx
Tobias Johansson 9a9789e736 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
2025-04-15 13:23:23 +00:00

56 lines
1.4 KiB
TypeScript

"use client"
import { useParams } from "next/navigation"
import { useState } from "react"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import ListingHotelCardDialog from "./ListingHotelCardDialog"
import StandaloneHotelCardDialog from "./StandaloneHotelCardDialog"
import styles from "./hotelCardDialog.module.css"
import type { HotelCardDialogProps } from "@/types/components/hotelReservation/selectHotel/map"
import type { Lang } from "@/constants/languages"
export default function HotelCardDialog({
data,
isOpen,
type = "standalone",
handleClose,
}: HotelCardDialogProps) {
const params = useParams()
const lang = params.lang as Lang
const [imageError, setImageError] = useState(false)
if (!data) {
return null
}
return (
<dialog open={isOpen} className={styles.dialog}>
<div className={styles.dialogContainer} data-type={type}>
<div onClick={handleClose}>
<MaterialIcon icon="close" className={styles.closeIcon} size={22} />
</div>
{type === "standalone" ? (
<StandaloneHotelCardDialog
data={data}
lang={lang}
imageError={imageError}
setImageError={setImageError}
/>
) : (
<ListingHotelCardDialog
data={data}
lang={lang}
imageError={imageError}
setImageError={setImageError}
/>
)}
</div>
</dialog>
)
}