Skip to content

Commit 3bf96a6

Browse files
committed
example: update nextjs example.
1 parent d589c09 commit 3bf96a6

18 files changed

+258
-81
lines changed

example/nextjs/.eslintrc.json

-3
This file was deleted.

example/nextjs/.gitignore

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# dependencies
44
/node_modules
55
/.pnp
6-
.pnp.js
7-
.yarn/install-state.gz
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
812

913
# testing
1014
/coverage
@@ -24,9 +28,10 @@
2428
npm-debug.log*
2529
yarn-debug.log*
2630
yarn-error.log*
31+
.pnpm-debug.log*
2732

28-
# local env files
29-
.env*.local
33+
# env files (can opt-in for committing if needed)
34+
.env*
3035

3136
# vercel
3237
.vercel

example/nextjs/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
22

33
## Getting Started
44

@@ -11,14 +11,14 @@ yarn dev
1111
# or
1212
pnpm dev
1313
# or
14-
bun run dev
14+
bun dev
1515
```
1616

1717
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
1818

1919
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
2020

21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
2222

2323
## Learn More
2424

@@ -27,10 +27,10 @@ To learn more about Next.js, take a look at the following resources:
2727
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
2828
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
2929

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
3131

3232
## Deploy on Vercel
3333

3434
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
3535

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

example/nextjs/next.config.js

-4
This file was deleted.

example/nextjs/next.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from 'next';
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;

example/nextjs/package.json

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
{
22
"name": "nextjs",
3-
"version": "4.23.10",
3+
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev",
6+
"dev": "next dev --turbopack",
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint"
1010
},
1111
"dependencies": {
1212
"@uiw/react-codemirror": "4.23.10",
13-
"next": "14.0.3",
1413
"react": "~18.2.0",
14+
"react-dom": "~18.2.0",
1515
"react-codemirror-merge": "4.23.10",
16-
"react-dom": "~18.2.0"
16+
"next": "15.3.1"
1717
},
1818
"devDependencies": {
19+
"typescript": "^5",
1920
"@types/node": "^20",
20-
"@types/react": "^18",
21-
"@types/react-dom": "^18",
22-
"autoprefixer": "^10.0.1",
23-
"eslint": "^8",
24-
"eslint-config-next": "14.0.3",
25-
"postcss": "^8",
26-
"tailwindcss": "^3.3.0",
27-
"typescript": "^5"
21+
"@types/react": "^18.2.0",
22+
"@types/react-dom": "^18.2.0"
2823
}
2924
}

example/nextjs/postcss.config.js

-6
This file was deleted.

example/nextjs/public/file.svg

+1
Loading

example/nextjs/public/globe.svg

+1
Loading

example/nextjs/public/vercel.svg

+1-1
Loading

example/nextjs/public/window.svg

+1
Loading

example/nextjs/src/app/globals.css

+32-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
4-
51
:root {
6-
--foreground-rgb: 0, 0, 0;
7-
--background-start-rgb: 214, 219, 220;
8-
--background-end-rgb: 255, 255, 255;
2+
--background: #ffffff;
3+
--foreground: #171717;
94
}
105

116
@media (prefers-color-scheme: dark) {
127
:root {
13-
--foreground-rgb: 255, 255, 255;
14-
--background-start-rgb: 0, 0, 0;
15-
--background-end-rgb: 0, 0, 0;
8+
--background: #0a0a0a;
9+
--foreground: #ededed;
1610
}
1711
}
1812

13+
html,
14+
body {
15+
max-width: 100vw;
16+
overflow-x: hidden;
17+
}
18+
1919
body {
20-
color: rgb(var(--foreground-rgb));
21-
background: linear-gradient(
22-
to bottom,
23-
transparent,
24-
rgb(var(--background-end-rgb))
25-
)
26-
rgb(var(--background-start-rgb));
20+
color: var(--foreground);
21+
background: var(--background);
22+
font-family: Arial, Helvetica, sans-serif;
23+
-webkit-font-smoothing: antialiased;
24+
-moz-osx-font-smoothing: grayscale;
25+
}
26+
27+
* {
28+
box-sizing: border-box;
29+
padding: 0;
30+
margin: 0;
31+
}
32+
33+
a {
34+
color: inherit;
35+
text-decoration: none;
36+
}
37+
38+
@media (prefers-color-scheme: dark) {
39+
html {
40+
color-scheme: dark;
41+
}
2742
}

example/nextjs/src/app/layout.tsx

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1-
import './globals.css';
21
import type { Metadata } from 'next';
3-
import { Inter } from 'next/font/google';
2+
import { Geist, Geist_Mono } from 'next/font/google';
3+
import './globals.css';
4+
5+
const geistSans = Geist({
6+
variable: '--font-geist-sans',
7+
subsets: ['latin'],
8+
});
49

5-
const inter = Inter({ subsets: ['latin'] });
10+
const geistMono = Geist_Mono({
11+
variable: '--font-geist-mono',
12+
subsets: ['latin'],
13+
});
614

715
export const metadata: Metadata = {
816
title: 'Create Next App',
917
description: 'Generated by create next app',
1018
};
1119

12-
export default function RootLayout({ children }: { children: React.ReactNode }) {
20+
export default function RootLayout({
21+
children,
22+
}: Readonly<{
23+
children: React.ReactNode;
24+
}>) {
1325
return (
1426
<html lang="en">
15-
<body className={inter.className}>
27+
<body className={`${geistSans.variable} ${geistMono.variable}`}>
1628
<header>
1729
<a href="/">Home</a> |<a href="/merge">Merge</a> |<a href="/textarea">TextArea</a>
1830
<br />

example/nextjs/src/app/merge/_editor/Com.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const MergeExample = () => {
1919
};
2020
const [originalValue, setOriginalValue] = useState(originalCode);
2121
const [modifiedValue, setModifiedValue] = useState(modifiedCode);
22-
const random = useRef<number>();
22+
const random = useRef<number>(1);
2323
const click = () => {
2424
random.current = Math.floor(Math.random() * 101);
2525
const code = '// hello world' + random.current + '\n' + originalCode;

0 commit comments

Comments
 (0)