Skip to content

Instantly share code, notes, and snippets.

@thianlopezz
Last active March 18, 2020 03:17
Show Gist options
  • Save thianlopezz/6d30943bb3349b859c2132b1edb92495 to your computer and use it in GitHub Desktop.
Save thianlopezz/6d30943bb3349b859c2132b1edb92495 to your computer and use it in GitHub Desktop.
import React from 'react';
import GoogleMapReact from 'google-map-react';
import { Avatar, Chip } from '@material-ui/core';
const FlagPin = ({ urlFlag, cases }) => (
<Chip avatar={<Avatar src={urlFlag} />} label={`${cases} casos`} />
);
export default function InffectedCountryMap({ inffectedCountries }) {
return (
<div style={{ height: '100%', width: '100%' }}>
<GoogleMapReact
bootstrapURLKeys={{ key: '' }}
defaultCenter={{ lat: 0, lng: 0 }}
defaultZoom={1}
>
{inffectedCountries.map(country =>
country.latlng ? (
<FlagPin
key={country.country_name}
lat={country.latlng[0]}
lng={country.latlng[1]}
cases={country.cases}
urlFlag={country.urlFlag}
/>
) : null,
)}
</GoogleMapReact>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment