← คอมโพเนนต์ทั้งหมด

ป๊อปอัป

ป๊อปอัปที่เป็นการ์ดของ shadcn ปักอยู่ที่พิกัด

ตัวอย่างทำงานบนคลังข้อมูลประเทศไทยสาธารณะของ MapScale

ติดตั้ง

npx shadcn@latest add https://mapscale.io/r/map-popup.json

วิธีใช้

import { MapPopup } from "@/components/mapscale/map-popup"

<Map>
	{open ? (
		<MapPopup lngLat={[100.5018, 13.7563]} onClose={() => setOpen(false)}>
			<p className="font-medium">Wat Arun</p>
		</MapPopup>
	) : null}
</Map>

พร็อพ

พร็อพชนิดค่าเริ่มต้นคำอธิบาย
lngLat[number, number]-Popup position as [lng, lat].
onClose() => void-Shows a close button and closes on Escape.
offsetnumber14Pixels between the coordinate and the popup tail.

คีย์

แผนที่ การค้นหาที่อยู่ และรายละเอียดสถานที่ใช้คีย์ pk_ ที่ปลอดภัยบนเบราว์เซอร์ ส่วนเส้นทางและ isochrone ต้องใช้คีย์ลับ sk_ จึงต้องผ่านเส้นทางพร็อกซีบนเซิร์ฟเวอร์ของแอปคุณ