Adapt the interactive map for reuse
This commit is contained in:
@@ -14,3 +14,9 @@
|
|||||||
top: var(--main-menu-desktop-height);
|
top: var(--main-menu-desktop-height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.closeButton {
|
||||||
|
pointer-events: initial;
|
||||||
|
box-shadow: var(--button-box-shadow);
|
||||||
|
gap: var(--Spacing-x-half);
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import { useIntl } from "react-intl"
|
|||||||
|
|
||||||
import useHotelPageStore from "@/stores/hotel-page"
|
import useHotelPageStore from "@/stores/hotel-page"
|
||||||
|
|
||||||
import MapContent from "@/components/Maps/InteractiveMap"
|
import CloseLargeIcon from "@/components/Icons/CloseLarge"
|
||||||
|
import InteractiveMap from "@/components/Maps/InteractiveMap"
|
||||||
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import { useHandleKeyUp } from "@/hooks/useHandleKeyUp"
|
import { useHandleKeyUp } from "@/hooks/useHandleKeyUp"
|
||||||
|
|
||||||
import Sidebar from "./Sidebar"
|
import Sidebar from "./Sidebar"
|
||||||
@@ -52,6 +54,20 @@ export default function DynamicMap({
|
|||||||
}
|
}
|
||||||
}, [isDynamicMapOpen, scrollHeightWhenOpened])
|
}, [isDynamicMapOpen, scrollHeightWhenOpened])
|
||||||
|
|
||||||
|
const closeButton = (
|
||||||
|
<Button
|
||||||
|
theme="base"
|
||||||
|
intent="inverted"
|
||||||
|
variant="icon"
|
||||||
|
size="small"
|
||||||
|
className={styles.closeButton}
|
||||||
|
onClick={closeDynamicMap}
|
||||||
|
>
|
||||||
|
<CloseLargeIcon color="burgundy" />
|
||||||
|
<span>{intl.formatMessage({ id: "Close the map" })}</span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<APIProvider apiKey={apiKey}>
|
<APIProvider apiKey={apiKey}>
|
||||||
<Modal isOpen={isDynamicMapOpen}>
|
<Modal isOpen={isDynamicMapOpen}>
|
||||||
@@ -68,7 +84,8 @@ export default function DynamicMap({
|
|||||||
pointsOfInterest={pointsOfInterest}
|
pointsOfInterest={pointsOfInterest}
|
||||||
onActivePoiChange={setActivePoi}
|
onActivePoiChange={setActivePoi}
|
||||||
/>
|
/>
|
||||||
<MapContent
|
<InteractiveMap
|
||||||
|
closeButton={closeButton}
|
||||||
coordinates={coordinates}
|
coordinates={coordinates}
|
||||||
pointsOfInterest={pointsOfInterest}
|
pointsOfInterest={pointsOfInterest}
|
||||||
activePoi={activePoi}
|
activePoi={activePoi}
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import {
|
|||||||
} from "@vis.gl/react-google-maps"
|
} from "@vis.gl/react-google-maps"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import useHotelPageStore from "@/stores/hotel-page"
|
|
||||||
|
|
||||||
import { MinusIcon, PlusIcon } from "@/components/Icons"
|
import { MinusIcon, PlusIcon } from "@/components/Icons"
|
||||||
import CloseLargeIcon from "@/components/Icons/CloseLarge"
|
|
||||||
import PoiMarker from "@/components/Maps/Markers/Poi"
|
import PoiMarker from "@/components/Maps/Markers/Poi"
|
||||||
import ScandicMarker from "@/components/Maps/Markers/Scandic"
|
import ScandicMarker from "@/components/Maps/Markers/Scandic"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
@@ -20,7 +17,7 @@ import Caption from "@/components/TempDesignSystem/Text/Caption"
|
|||||||
|
|
||||||
import styles from "./interactiveMap.module.css"
|
import styles from "./interactiveMap.module.css"
|
||||||
|
|
||||||
import type { MapContentProps } from "@/types/components/hotelPage/map/mapContent"
|
import type { InteractiveMapProps } from "@/types/components/hotelPage/map/interactiveMap"
|
||||||
|
|
||||||
export default function InteractiveMap({
|
export default function InteractiveMap({
|
||||||
coordinates,
|
coordinates,
|
||||||
@@ -28,9 +25,9 @@ export default function InteractiveMap({
|
|||||||
activePoi,
|
activePoi,
|
||||||
mapId,
|
mapId,
|
||||||
onActivePoiChange,
|
onActivePoiChange,
|
||||||
}: MapContentProps) {
|
closeButton,
|
||||||
|
}: InteractiveMapProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const { closeDynamicMap } = useHotelPageStore()
|
|
||||||
const map = useMap()
|
const map = useMap()
|
||||||
|
|
||||||
const mapOptions: MapProps = {
|
const mapOptions: MapProps = {
|
||||||
@@ -98,17 +95,7 @@ export default function InteractiveMap({
|
|||||||
))}
|
))}
|
||||||
</Map>
|
</Map>
|
||||||
<div className={styles.ctaButtons}>
|
<div className={styles.ctaButtons}>
|
||||||
<Button
|
{closeButton}
|
||||||
theme="base"
|
|
||||||
intent="inverted"
|
|
||||||
variant="icon"
|
|
||||||
size="small"
|
|
||||||
className={styles.closeButton}
|
|
||||||
onClick={closeDynamicMap}
|
|
||||||
>
|
|
||||||
<CloseLargeIcon color="burgundy" />
|
|
||||||
<span>{intl.formatMessage({ id: "Close the map" })}</span>
|
|
||||||
</Button>
|
|
||||||
<div className={styles.zoomButtons}>
|
<div className={styles.zoomButtons}>
|
||||||
<Button
|
<Button
|
||||||
theme="base"
|
theme="base"
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
import { ReactElement } from "react"
|
||||||
|
|
||||||
import type { Coordinates } from "@/types/components/maps/coordinates"
|
import type { Coordinates } from "@/types/components/maps/coordinates"
|
||||||
import type { PointOfInterest } from "@/types/hotel"
|
import type { PointOfInterest } from "@/types/hotel"
|
||||||
|
|
||||||
export interface MapContentProps {
|
export interface InteractiveMapProps {
|
||||||
coordinates: Coordinates
|
coordinates: Coordinates
|
||||||
pointsOfInterest: PointOfInterest[]
|
pointsOfInterest: PointOfInterest[]
|
||||||
activePoi: PointOfInterest["name"] | null
|
activePoi: PointOfInterest["name"] | null
|
||||||
mapId: string
|
mapId: string
|
||||||
onActivePoiChange: (poi: PointOfInterest["name"] | null) => void
|
onActivePoiChange: (poi: PointOfInterest["name"] | null) => void
|
||||||
|
closeButton: ReactElement
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user