Skip to content

Commit

Permalink
Update basic example for App Router. (#4839)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshew committed May 5, 2023
1 parent 8284e11 commit 93ddc53
Show file tree
Hide file tree
Showing 18 changed files with 1,033 additions and 376 deletions.
11 changes: 11 additions & 0 deletions examples/basic/apps/docs/app/layout.tsx
@@ -0,0 +1,11 @@
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
10 changes: 10 additions & 0 deletions examples/basic/apps/docs/app/page.tsx
@@ -0,0 +1,10 @@
import { Button, Header } from "ui";

export default function Page() {
return (
<>
<Header text="Docs" />
<Button />
</>
);
}
2 changes: 1 addition & 1 deletion examples/basic/apps/docs/package.json
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "latest",
"next": "^13.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
Expand Down
10 changes: 0 additions & 10 deletions examples/basic/apps/docs/pages/index.tsx

This file was deleted.

5 changes: 4 additions & 1 deletion examples/basic/apps/docs/tsconfig.json
@@ -1,5 +1,8 @@
{
"extends": "tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"plugins": [{ "name": "next" }]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
11 changes: 11 additions & 0 deletions examples/basic/apps/web/app/layout.tsx
@@ -0,0 +1,11 @@
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
10 changes: 10 additions & 0 deletions examples/basic/apps/web/app/page.tsx
@@ -0,0 +1,10 @@
import { Button, Header } from "ui";

export default function Page() {
return (
<>
<Header text="Web" />
<Button />
</>
);
}
2 changes: 1 addition & 1 deletion examples/basic/apps/web/package.json
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "latest",
"next": "^13.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
Expand Down
10 changes: 0 additions & 10 deletions examples/basic/apps/web/pages/index.tsx

This file was deleted.

5 changes: 4 additions & 1 deletion examples/basic/apps/web/tsconfig.json
@@ -1,5 +1,8 @@
{
"extends": "tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"plugins": [{ "name": "next" }]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion examples/basic/package.json
Expand Up @@ -10,7 +10,7 @@
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"prettier": "^2.5.1",
"turbo": "latest"
"turbo": "^1.9.3"
},
"packageManager": "pnpm@7.15.0"
}
4 changes: 2 additions & 2 deletions examples/basic/packages/eslint-config-custom/package.json
Expand Up @@ -4,10 +4,10 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"eslint-config-next": "latest",
"eslint-config-next": "^13.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "7.28.0",
"eslint-config-turbo": "latest"
"eslint-config-turbo": "^1.9.3"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions examples/basic/packages/tsconfig/nextjs.json
Expand Up @@ -3,6 +3,7 @@
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"allowJs": true,
"declaration": false,
"declarationMap": false,
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/packages/tsconfig/react-library.json
Expand Up @@ -4,7 +4,7 @@
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx",
"lib": ["ES2015"],
"lib": ["ES2015", "DOM"],
"module": "ESNext",
"target": "es6"
}
Expand Down
4 changes: 3 additions & 1 deletion examples/basic/packages/ui/Button.tsx
@@ -1,5 +1,7 @@
"use client";

import * as React from "react";

export const Button = () => {
return <button>Boop</button>;
return <button onClick={() => alert("boop")}>Boop</button>;
};
5 changes: 5 additions & 0 deletions examples/basic/packages/ui/Header.tsx
@@ -0,0 +1,5 @@
import * as React from "react";

export const Header = ({ text }: { text: string }) => {
return <h1>{text}</h1>;
};
1 change: 1 addition & 0 deletions examples/basic/packages/ui/index.tsx
@@ -1,2 +1,3 @@
import * as React from "react";
export * from "./Button";
export * from "./Header";

1 comment on commit 93ddc53

@vercel
Copy link

@vercel vercel bot commented on 93ddc53 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

examples-basic-web – ./examples/basic/apps/web

examples-basic-web-git-main.vercel.sh
examples-basic-web.vercel.sh
turborepo-examples-basic-web.vercel.sh

Please sign in to comment.