diff --git a/src/components/misc/Flag.tsx b/src/components/misc/Flag.tsx new file mode 100644 index 0000000..50269ff --- /dev/null +++ b/src/components/misc/Flag.tsx @@ -0,0 +1,20 @@ +interface Props { + countryCode: string, + width: number, +}; + +const Flag = ({ countryCode, width }: Props): JSX.Element => { + + const getFlagUrl = (code: string, w: number = 64) => { + const protocol = 'https'; + const cdn = 'flagcdn.com'; + const dimensions = `${width}x${width * 0.75}`; + const country = countryCode.toLowerCase(); + const ext = 'png'; + return `${protocol}://${cdn}/${dimensions}/${country}.${ext}`; + }; + + return ({countryCode}); +} + +export default Flag; diff --git a/src/components/misc/LocationMap.tsx b/src/components/misc/LocationMap.tsx new file mode 100644 index 0000000..44e62d8 --- /dev/null +++ b/src/components/misc/LocationMap.tsx @@ -0,0 +1,59 @@ +import { + ComposableMap, + Geographies, + Geography, + Annotation, +} from 'react-simple-maps'; + +import colors from 'styles/colors'; +import MapFeatures from 'assets/data/map-features.json'; + +interface Props { + lat: number, + lon: number, + label?: string, +}; + +const MapChart = (location: Props) => { + const { lat, lon, label } = location; + + return ( + + + {({ geographies }) => + geographies.map((geo) => ( + + )) + } + + + + {label || "Server"} + + + + ); +}; + +export default MapChart;