Skip to content

Commit

Permalink
add map and google map api
Browse files Browse the repository at this point in the history
  • Loading branch information
kohta9521 committed Nov 15, 2023
1 parent 2e949aa commit 3990fdb
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
74 changes: 72 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"format": "npx prettier --write ."
},
"dependencies": {
"@react-google-maps/api": "^2.19.2",
"next": "14.0.2",
"react": "^18",
"react-dom": "^18"
Expand Down
3 changes: 3 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import styles from "./page.module.css";

import Map from "../components/map";

export default function Home() {
return (
<main className={styles.main}>
<h1>ここごはん</h1>
<Map />
</main>
);
}
30 changes: 30 additions & 0 deletions src/components/Map.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client'
import React from "react";
import { GoogleMap, LoadScript } from "@react-google-maps/api";

const containerStyle = {
width: "100%",
height: "86vh",
};

const center = {
lat: 34.7293466708865,
lng: 135.49939605607292,
};

const zoom = 10;

const Map = () => {
return (
<LoadScript googleMapsApiKey={process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY}>
<GoogleMap
mapContainerStyle={containerStyle}
center={center}
zoom={zoom}
></GoogleMap>
</LoadScript>
);
};

export default Map;

0 comments on commit 3990fdb

Please sign in to comment.