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: convert @next/third-parties examples from JS to TS #73602

Merged
merged 9 commits into from
Dec 17, 2024
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
2 changes: 1 addition & 1 deletion examples/with-google-maps-embed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Example app using Google Maps Embed

This example shows how to embed a Google Maps Embed using `@next/third-parties`.
This example shows how to embed a Google Maps Embed using [`@next/third-parties`](https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries).

## Deploy your own

Expand Down
7 changes: 0 additions & 7 deletions examples/with-google-maps-embed/app/layout.js

This file was deleted.

18 changes: 18 additions & 0 deletions examples/with-google-maps-embed/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "With Google Maps Embed",
description: "Next.js example with Google Maps Embed.",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
11 changes: 8 additions & 3 deletions examples/with-google-maps-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"start": "next start"
},
"dependencies": {
"next": "latest",
"@next/third-parties": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "latest",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"typescript": "^5.7.2"
}
}
24 changes: 24 additions & 0 deletions examples/with-google-maps-embed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion examples/with-google-tag-manager/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Example app using Google Tag Manager

This example shows how to include Google Tag Manager in a Next.js application using `@next/third-parties`. The GTM container is instantiated in `layout.js` and the `sendGTMEvent` function is fired in the `EventButton` client component.
This example shows how to include Google Tag Manager in a Next.js application using [`@next/third-parties`](https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries). The GTM container is instantiated in `layout.tsx` and the `sendGTMEvent` function is fired in the `EventButton` client component.

## Deploy your own

Expand Down
12 changes: 0 additions & 12 deletions examples/with-google-tag-manager/app/layout.js

This file was deleted.

22 changes: 22 additions & 0 deletions examples/with-google-tag-manager/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Metadata } from "next";
import { GoogleTagManager } from "@next/third-parties/google";

export const metadata: Metadata = {
title: "With Google Tag Manager",
description: "Next.js example with Google Tag Manager.",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>{children}</body>
<GoogleTagManager
gtmId={process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID as string}
/>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventButton } from "./components/EventButton";
import { EventButton } from "@/_components/EventButton";

export default function Page() {
return (
Expand Down
11 changes: 8 additions & 3 deletions examples/with-google-tag-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"start": "next start"
},
"dependencies": {
"next": "latest",
"@next/third-parties": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "latest",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"typescript": "^5.7.2"
}
}
27 changes: 27 additions & 0 deletions examples/with-google-tag-manager/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion examples/with-youtube-embed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Example app using YouTube Embed

This example shows how to embed a YouTube Embed using `@next/third-parties`.
This example shows how to embed a YouTube Embed using [`@next/third-parties`](https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries).

## Deploy your own

Expand Down
7 changes: 0 additions & 7 deletions examples/with-youtube-embed/app/layout.js

This file was deleted.

18 changes: 18 additions & 0 deletions examples/with-youtube-embed/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "With YouTube Embed",
description: "Next.js example with YouTube Embed.",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
11 changes: 8 additions & 3 deletions examples/with-youtube-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"start": "next start"
},
"dependencies": {
"next": "latest",
"@next/third-parties": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "latest",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"typescript": "^5.7.2"
}
}
24 changes: 24 additions & 0 deletions examples/with-youtube-embed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading