Last active
March 18, 2020 03:17
-
-
Save thianlopezz/6d30943bb3349b859c2132b1edb92495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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