import styled from "styled-components"; import React, { FC } from "react"; // import { VectorMap } from "@south-paw/react-vector-maps"; import { Colors } from "../../consts"; import Tooltip from "../Tooltip"; import world from "./world.json"; const Svg = styled.svg` path { fill: ${Colors.Map0}; stroke: #fff; } path.country-6 { fill: ${Colors.Map06}; stroke: #fff; } path.country-5 { fill: ${Colors.Map05}; stroke: #fff; } path.country-4 { fill: ${Colors.Map04}; stroke: #fff; } path.country-3 { fill: ${Colors.Map03}; stroke: #fff; } path.country-2 { fill: ${Colors.Map02}; stroke: #fff; } path.country-1 { fill: ${Colors.Map01}; stroke: #fff; } `; interface Props { data: Array<{ name: string; value: number }>; } const Map: FC = ({ data }) => { const [mostVisits] = data.sort((a, b) => (b.value - a.value > 0 ? 1 : -1)); return ( <> {world.layers.map(layer => ( {layer.name}:{" "} {data.find(d => d.name.toLowerCase() === layer.id)?.value || 0} ))} {world.layers.map(layer => ( d.name.toLowerCase() === layer.id)?.value || 0) / mostVisits?.value || 0) * 6 )}`} aria-label={layer.name} d={layer.d} /> ))} ); }; export default Map;