import React, { Component } from "react";
import Places from "./Maps"; 
interface MapHomeProps {
  newLat?: any;
  newLng?: any;
  draggable?: boolean;
  setLocation: (location: string) => void; 
}

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} 
        />
      </div>
    );
  }
}

export default MapHome;
