Skip to main content
Skip to main content
FijiTanzaniaWestern SaharaCanada $ 53,400United States $ 85,800KazakhstanUzbekistanPapua New GuineaIndonesia $ 4,900Argentina $ 13,900ChileDemocratic Republic of the CongoSomaliaKenyaSudanChadHaitiDominican RepublicRussia $ 14,900BahamasFalkland IslandsNorwayGreenlandTimor-LesteSouth Africa $ 6,000LesothoMexico $ 14,000UruguayBrazil $ 10,300BoliviaPeruColombiaPanamaCosta RicaNicaraguaHondurasEl SalvadorGuatemalaBelizeVenezuelaGuyanaSurinameFrance $ 46,200EcuadorPuerto RicoJamaicaCubaZimbabweBotswanaNamibiaSenegalMaliMauritaniaBeninNigerNigeria $ 800CameroonTogoGhanaCôted'IvoireGuineaGuinea-BissauLiberiaSierra LeoneBurkina FasoCentral African RepublicRepublic of the CongoGabonEquatorial GuineaZambiaMalawiMozambiqueEswatiniAngolaBurundiIsraelLebanonMadagascarPalestineThe GambiaTunisiaAlgeriaJordanUnited Arab EmiratesQatarKuwaitIraqOmanVanuatuCambodiaThailandLao PDRMyanmarVietnamDem. Rep. KoreaRepublic of Korea $ 36,100MongoliaIndia $ 2,700BangladeshBhutanNepalPakistanAfghanistanTajikistanKyrgyzstanTurkmenistanIranSyriaArmeniaSwedenBelarusUkrainePolandAustriaHungaryMoldovaRomaniaLithuaniaLatviaEstoniaGermany $ 55,800BulgariaGreeceTurkey $ 15,500AlbaniaCroatiaSwitzerlandLuxembourgBelgiumNetherlandsPortugalSpainIrelandNew CaledoniaSolomon IslandsNew ZealandAustralia $ 64,700Sri LankaChina $ 13,300TaiwanItalyDenmarkUnited Kingdom $ 52,600IcelandAzerbaijanGeorgiaPhilippinesMalaysiaBrunei DarussalamSloveniaFinlandSlovakiaCzech RepublicEritreaJapan $ 32,500ParaguayYemenSaudi Arabia $ 33,000Northern CyprusCyprusMoroccoEgypt $ 3,300LibyaEthiopiaDjiboutiSomalilandUgandaRwandaBosnia and HerzegovinaMacedoniaSerbiaMontenegroKosovoTrinidad and TobagoSouth SudanCanada $ 53,400United States $ 85,800Indonesia $ 4,900Argentina $ 13,900Russia $ 14,900South Africa $ 6,000Mexico $ 14,000Brazil $ 10,300France $ 46,200Nigeria $ 800Republic of Korea $ 36,100India $ 2,700Germany $ 55,800Turkey $ 15,500Australia $ 64,700China $ 13,300United Kingdom $ 52,600Japan $ 32,500Saudi Arabia $ 33,000Egypt $ 3,300
Map zoom reset
import * as React from "react";
import { useState } from "react";
import WorldMap from "react-svg-worldmap";
import type { MapTheme, ProjectionOption } from "react-svg-worldmap";
import { gdpData } from "../data/CountryData";
import { useMapTheme } from "./mapTheme";

// The atlas theme: blue water, slate borders and light land for countries
// without data. Borders stay one pixel wide as you zoom. Any color prop you
// pass (backgroundColor, borderColor, styleFunction, ...) overrides the theme.
export default function AtlasTheme(): JSX.Element {
const siteTheme = useMapTheme();
const [theme, setTheme] = useState<MapTheme>("atlas");
const [projection, setProjection] = useState<ProjectionOption>("equalEarth");

// The atlas palette is the same in light and dark mode; only the tooltip
// follows the site. The default theme takes all the site's map colors.
const colors =
theme === "atlas"
? {
tooltipBgColor: siteTheme.tooltipBgColor,
tooltipTextColor: siteTheme.tooltipTextColor,
}
: siteTheme;

return (
<>
<select
aria-label="Theme"
value={theme}
onChange={(e) => setTheme(e.target.value as MapTheme)}>
<option value="atlas">Atlas</option>
<option value="default">Default</option>
</select>{" "}
<select
aria-label="Projection"
value={projection}
onChange={(e) => setProjection(e.target.value as ProjectionOption)}>
<option value="equalEarth">Equal Earth</option>
<option value="mercator">Mercator</option>
</select>
<WorldMap
{...colors}
theme={theme}
title="GDP per capita"
color="#e65100"
valuePrefix="$"
size="responsive"
data={gdpData}
projection={projection}
zoom={{ maxScale: 8 }}
frame
/>
</>
);
}