Use datamaps world map instead of world-110m

This commit is contained in:
Denys Dovhan 2021-03-26 00:14:23 +02:00
parent 94af336388
commit edc3251966
No known key found for this signature in database
GPG Key ID: 39B5E8E92FA404F8
2 changed files with 2 additions and 6 deletions

View File

@ -4,17 +4,14 @@ import ReactTooltip from 'react-tooltip';
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps'; import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
import classNames from 'classnames'; import classNames from 'classnames';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import Datamap from 'datamaps';
import useTheme from 'hooks/useTheme'; import useTheme from 'hooks/useTheme';
import { THEME_COLORS } from 'lib/constants'; import { THEME_COLORS } from 'lib/constants';
import styles from './WorldMap.module.css'; import styles from './WorldMap.module.css';
import useCountryNames from 'hooks/useCountryNames'; import useCountryNames from 'hooks/useCountryNames';
import useLocale from 'hooks/useLocale'; import useLocale from 'hooks/useLocale';
import { useRouter } from 'next/router';
const geoUrl = '/world-110m.json';
function WorldMap({ data, className }) { function WorldMap({ data, className }) {
const { basePath } = useRouter();
const [tooltip, setTooltip] = useState(); const [tooltip, setTooltip] = useState();
const [theme] = useTheme(); const [theme] = useTheme();
const colors = useMemo( const colors = useMemo(
@ -60,7 +57,7 @@ function WorldMap({ data, className }) {
> >
<ComposableMap projection="geoMercator"> <ComposableMap projection="geoMercator">
<ZoomableGroup zoom={0.8} minZoom={0.7} center={[0, 40]}> <ZoomableGroup zoom={0.8} minZoom={0.7} center={[0, 40]}>
<Geographies geography={`${basePath}${geoUrl}`}> <Geographies geography={Datamap.prototype.worldTopo}>
{({ geographies }) => { {({ geographies }) => {
return geographies.map(geo => { return geographies.map(geo => {
const code = geo.properties.ISO_A2; const code = geo.properties.ISO_A2;

File diff suppressed because one or more lines are too long