feat(SW-68): add static map component

This commit is contained in:
Fredrik Thorsson
2024-08-08 13:33:47 +02:00
parent ad96c9bd30
commit 4c0c90a0f0
13 changed files with 100 additions and 16 deletions
@@ -3,6 +3,7 @@
background-color: var(--Base-Surface-Primary-light-Normal);
border: 1px solid var(--Base-Border-Subtle);
border-radius: var(--Corner-radius-Small);
overflow: hidden;
height: 460px;
width: 480px;
}
@@ -11,7 +12,7 @@
height: auto;
max-height: 180px;
object-fit: cover;
overflow: hidden;
width: 100%;
}
+24
View File
@@ -0,0 +1,24 @@
import Image from "@/components/Image"
import { StaticMapProps } from "@/types/components/maps/staticMap/staticMap"
export default function StaticMap({
city,
width,
height,
zoomLevel,
mapType,
}: StaticMapProps) {
const apiKey = process.env.NEXT_PUBLIC_GOOGLE_STATIC_MAP_KEY
const mapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${city}&zoom=${zoomLevel}&size=${width}x${height}&maptype=${mapType}&key=${apiKey}`
return (
<Image
src=""
overrideSrc={mapUrl}
alt={`Map of ${city} city center`}
width={width}
height={height}
/>
)
}