Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit bdc34d3

Browse files
authored
Merge pull request #210 from SchoolyB/Development
Install map dependencies/build map page/embed map/add map styling/
2 parents cb2a468 + 3a27834 commit bdc34d3

File tree

8 files changed

+241
-8
lines changed

8 files changed

+241
-8
lines changed

client/package-lock.json

Lines changed: 187 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"@react-google-maps/api": "^2.18.1",
1213
"@vercel/analytics": "^1.0.0",
1314
"axios": "^1.2.3",
1415
"dotenv": "^16.0.3",
16+
"google-map-react": "^2.2.1",
1517
"ol": "^7.3.0",
1618
"react": "^18.2.0",
1719
"react-dom": "^18.2.0",

client/src/includes/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import axios from "axios";
1+
import axios from 'axios'
22

33
const baseURL = import.meta.env.VITE_API_URL
44

5-
export const api = axios.create({ baseURL});
5+
export const api = axios.create({ baseURL })

client/src/pages/map.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { GoogleMap, Marker, useLoadScript } from '@react-google-maps/api'
2+
import { useMemo } from 'react'
3+
const mapKey = import.meta.env.VITE_MAP_KEY
4+
5+
const map = () => {
6+
const { isLoaded } = useLoadScript({
7+
googleMapsApiKey: `${mapKey}` || '',
8+
})
9+
const center = useMemo(() => ({ lat: 0, lng: 0 }), [])
10+
11+
return (
12+
<div className="map">
13+
{!isLoaded ? (
14+
<h1>Loading...</h1>
15+
) : (
16+
<GoogleMap
17+
mapContainerClassName="map-container"
18+
center={center}
19+
zoom={3.5}
20+
></GoogleMap>
21+
)}
22+
</div>
23+
)
24+
}
25+
26+
export default map

client/styles/scss/_map.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.map {
2+
height: 100vh;
3+
width: 100vw;
4+
}
5+
6+
.map-container {
7+
height: 100%;
8+
width: 100%;
9+
}

0 commit comments

Comments
 (0)