mediahub-fe/components/maps/MapHome.tsx

31 lines
792 B
TypeScript

import React, { Component } from "react";
import Places from "./Maps"; // Pastikan ini adalah komponen Places
interface MapHomeProps {
newLat?: any;
newLng?: any;
draggable?: boolean;
setLocation: (location: string) => void; // Pastikan properti ini ada
}
class MapHome extends Component<MapHomeProps> {
render() {
const { newLat, newLng, draggable, setLocation } = this.props;
const lat = newLat || -6.2393033;
const lng = newLng || 106.8013579;
return (
<div style={{ marginBottom: "10px", marginTop: "8px" }}>
<Places
center={{ lat: Number(lat), lng: Number(lng) }}
draggable={draggable}
onLocationChange={setLocation} // Kirimkan setLocation ke Places
/>
</div>
);
}
}
export default MapHome;