Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Examples) Add with-google-maps-embed example #57365

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/with-google-maps-embed/.env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_GOOGLE_API_KEY=
36 changes: 36 additions & 0 deletions examples/with-google-maps-embed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
35 changes: 35 additions & 0 deletions examples/with-google-maps-embed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Example app using Google Maps Embed

This example shows how to embed a Google Maps Embed using `@next/third-parties`.

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-google-maps-embed&project-name=with-google-maps-embed&repository-name=with-google-maps-embed)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example with-google-maps-embed with-google-maps-embed-app
```

```bash
yarn create next-app --example with-google-maps-embed with-google-maps-embed-app
```

```bash
pnpm create next-app --example with-google-maps-embed with-google-maps-embed-app
```

Next, copy the `.env.local.example` file in this directory to `.env.local` (which will be ignored by Git):

```bash
cp .env.local.example .env.local
```

Set the `NEXT_PUBLIC_GOOGLE_API_KEY` variable in `.env.local` to match your Google Maps API Key.

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
7 changes: 7 additions & 0 deletions examples/with-google-maps-embed/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
17 changes: 17 additions & 0 deletions examples/with-google-maps-embed/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { GoogleMapsEmbed } from '@next/third-parties/google'

const API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY

export default function Page() {
return (
<div>
<GoogleMapsEmbed
apiKey={API_KEY}
height={400}
width={700}
mode="place"
q="Brooklyn+Bridge,New+York,NY"
/>
</div>
)
}
14 changes: 14 additions & 0 deletions examples/with-google-maps-embed/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"@next/third-parties": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
Loading