backend-api/frontend/app/map/components/map-container.tsx
2025-04-07 21:07:56 +07:00

46 lines
1.3 KiB
TypeScript

"use client"
import { useEffect, useRef } from "react"
interface MapContainerProps {
selectedLocation: {
lat: number
lng: number
name?: string
}
}
export function MapContainer({ selectedLocation }: MapContainerProps) {
const mapRef = useRef<HTMLDivElement>(null)
useEffect(() => {
// This is a placeholder for actual map integration
// In a real application, you would use a library like Google Maps, Mapbox, or Leaflet
const mapElement = mapRef.current
if (mapElement) {
// Simulate map loading with a background image
mapElement.style.backgroundImage = "url('/placeholder.svg?height=800&width=1200')"
mapElement.style.backgroundSize = "cover"
mapElement.style.backgroundPosition = "center"
}
// Clean up function
return () => {
if (mapElement) {
mapElement.style.backgroundImage = ""
}
}
}, [selectedLocation])
return (
<div ref={mapRef} className="absolute inset-0 h-full w-full bg-muted/20 dark:bg-muted/10">
{/* Map markers would be rendered here in a real implementation */}
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
<div className="h-6 w-6 animate-pulse rounded-full bg-red-500 ring-4 ring-red-300 dark:ring-red-800"></div>
</div>
</div>
)
}