Files
CMS-Client/components/Pages/Maps/BasicMarkers.js
CHIEFSOFT\ameye 5f95d857d4 first commit
2023-10-14 22:02:57 -04:00

105 lines
3.1 KiB
JavaScript

import React from "react";
import Card from "@mui/material/Card";
import { Typography } from "@mui/material";
import {
ComposableMap,
Geographies,
Geography,
Marker
} from "react-simple-maps";
const geoUrl =
"https://raw.githubusercontent.com/deldersveld/topojson/master/continents/south-america.json";
const markers = [
{
markerOffset: -30,
name: "Buenos Aires",
coordinates: [-58.3816, -34.6037]
},
{ markerOffset: 15, name: "La Paz", coordinates: [-68.1193, -16.4897] },
{ markerOffset: 15, name: "Brasilia", coordinates: [-47.8825, -15.7942] },
{ markerOffset: 15, name: "Santiago", coordinates: [-70.6693, -33.4489] },
{ markerOffset: 15, name: "Bogota", coordinates: [-74.0721, 4.711] },
{ markerOffset: 15, name: "Quito", coordinates: [-78.4678, -0.1807] },
{ markerOffset: -30, name: "Georgetown", coordinates: [-58.1551, 6.8013] },
{ markerOffset: -30, name: "Asuncion", coordinates: [-57.5759, -25.2637] },
{ markerOffset: 15, name: "Paramaribo", coordinates: [-55.2038, 5.852] },
{ markerOffset: 15, name: "Montevideo", coordinates: [-56.1645, -34.9011] },
{ markerOffset: 15, name: "Caracas", coordinates: [-66.9036, 10.4806] },
{ markerOffset: 15, name: "Lima", coordinates: [-77.0428, -12.0464] }
];
const BasicMarkers = () => {
return (
<>
<Card
sx={{
boxShadow: "none",
borderRadius: "10px",
p: "25px",
mb: "15px",
}}
>
<Typography
as="h3"
sx={{
fontSize: 18,
fontWeight: 500,
borderBottom: "1px solid #EEF0F7",
paddingBottom: "5px",
mb: "15px",
}}
className="for-dark-bottom-border"
>
Basic Markers
</Typography>
<ComposableMap
projection="geoAzimuthalEqualArea"
projectionConfig={{
rotate: [58, 20, 0],
scale: 400
}}
>
<Geographies geography={geoUrl}>
{({ geographies }) =>
geographies.map((geo) => (
<Geography
key={geo.rsmKey}
geography={geo}
fill="#EAEAEC"
stroke="#D6D6DA"
/>
))
}
</Geographies>
{markers.map(({ name, coordinates, markerOffset }) => (
<Marker key={name} coordinates={coordinates}>
<g
fill="none"
stroke="#FF5533"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
transform="translate(-12, -24)"
>
<circle cx="12" cy="10" r="3" />
<path d="M12 21.7C17.3 17 20 13 20 10a8 8 0 1 0-16 0c0 3 2.7 6.9 8 11.7z" />
</g>
<text
textAnchor="middle"
y={markerOffset}
style={{ fontFamily: "system-ui", fill: "#5D5A6D" }}
>
{name}
</text>
</Marker>
))}
</ComposableMap>
</Card>
</>
);
};
export default BasicMarkers;