1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00
pds-2021-g2-nest/nest_frontend/components/base/BoxMap.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

import React from "react"
import Style from "./BoxMap.module.css"
import BoxFull from "./BoxFull"
import { MapContainer, TileLayer } from "react-leaflet"
2021-05-20 10:16:01 +00:00
export default function BoxMap({
setMap,
startingPosition = { lat: 41.89309, lng: 12.48289 },
startingZoom = 3,
button,
children,
...props
}) {
return (
<BoxFull
childrenClassName={Style.BoxMapContents}
{...props}
>
<MapContainer
center={startingPosition}
zoom={startingZoom}
className={Style.MapContainer}
whenCreated={setMap}
>
<TileLayer
attribution='(c) <a href="https://osm.org/copyright">OpenStreetMap contributors</a>'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
2021-05-20 09:39:40 +00:00
{children}
<div className={"leaflet-top leaflet-right"}>
<div className={"leaflet-control"}>
{button}
</div>
</div>
</MapContainer>
</BoxFull>
)
}