Skip to content

Commit 555a649

Browse files
committed
refactor: update next 13 & other deps with new UI
1 parent cb15f89 commit 555a649

15 files changed

+1478
-1005
lines changed

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@ You can check [demo](https://next-typescript-tailwind-starter.vercel.app/)
77
## Features
88

99
- [React.js 18](https://reactjs.org/blog/2022/03/29/react-v18.html) - Blog introduce react v18.0.
10-
- [Next.js 12](https://nextjs.org/blog/next-12) - Blog introduce next.js 12.
11-
- [Typescript 4](https://www.typescriptlang.org/) - Documentation of typescript.
12-
- [Next PWA 5](https://www.npmjs.com/package/next-pwa) - Documentation of next pwa.
10+
- [Next.js 13](https://nextjs.org/blog/next-13) - Blog introduce next.js 13.
11+
- [Typescript 5](https://www.typescriptlang.org/) - Documentation of typescript.
1312
- [Tailwind CSS 3](https://tailwindcss.com/docs/) - Documentation of tailwind css.
1413
- [Next PWA 5](https://www.npmjs.com/package/next-pwa) - Documentation of next pwa.
1514
- [Docker](https://docs.docker.com/) - Documentation of Docker.
1615
- [Eslint 8](https://eslint.org/docs/user-guide/getting-started) - Documentation of eslint.
17-
- [Prettier 2](https://prettier.io/docs/en/index.html) - Documentation of prettier.
18-
- [Husky 7](https://typicode.github.io/husky/#/) - Documentation of husky.
19-
- [Lint Staged 13](https://github.com/okonet/lint-staged) - Documentation of lint staged.
16+
- [Prettier 3](https://prettier.io/docs/en/index.html) - Documentation of prettier.
17+
- [Husky 8](https://typicode.github.io/husky/#/) - Documentation of husky.
18+
- [Lint Staged 14](https://github.com/okonet/lint-staged) - Documentation of lint staged.
2019

2120
## Usage
2221

23-
This project using node >= 14.19.2 & yarn
22+
This project using node >= 16.14 & yarn 1.22.19
2423

2524
### Installation
2625

@@ -50,6 +49,8 @@ You can start editing the page by modifying `pages/index.tsx`. The page auto-upd
5049

5150
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
5251

52+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
53+
5354
#### Docker Build
5455

5556
```bash

global.d.ts

Whitespace-only changes.

package.json

+16-17
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"dev": "next dev",
2929
"build": "next build",
3030
"start": "next start",
31-
"telemetry": "next telemetry",
3231
"lint": "next lint",
3332
"format": "prettier --ignore-path .gitignore \"**/*.+(js|ts|tsx|css|scss|json|md|html)\" --write",
3433
"type-check": "tsc --noEmit",
@@ -39,28 +38,28 @@
3938
"postpublish": "pinst --enable"
4039
},
4140
"dependencies": {
42-
"autoprefixer": "^10.4.12",
43-
"next": "^12.3.1",
41+
"next": "^13.5.4",
4442
"next-pwa": "^5.6.0",
45-
"postcss": "^8.4.17",
4643
"react": "^18.2.0",
47-
"react-dom": "^18.2.0",
48-
"tailwindcss": "^3.1.8"
44+
"react-dom": "^18.2.0"
4945
},
5046
"devDependencies": {
51-
"@types/node": "18.8.4",
52-
"@types/react": "^18.0.21",
53-
"@types/react-dom": "18.0.6",
54-
"eslint": "8.25.0",
55-
"eslint-config-next": "^12.3.1",
56-
"eslint-config-prettier": "^8.5.0",
57-
"husky": "^8.0.1",
58-
"lint-staged": "^13.0.3",
47+
"@types/node": "^20.8.4",
48+
"@types/react": "^18.2.28",
49+
"@types/react-dom": "^18.2.13",
50+
"autoprefixer": "^10.4.16",
51+
"eslint": "^8.51.0",
52+
"eslint-config-next": "^13.5.4",
53+
"eslint-config-prettier": "^9.0.0",
54+
"husky": "^8.0.3",
55+
"lint-staged": "^14.0.1",
5956
"pinst": "^3.0.0",
60-
"prettier": "^2.7.1",
61-
"typescript": "4.8.4"
57+
"postcss": "^8.4.31",
58+
"prettier": "^3.0.3",
59+
"tailwindcss": "^3.3.3",
60+
"typescript": "^5.2.2"
6261
},
6362
"engines": {
64-
"node": ">=14.19.2"
63+
"node": ">=16.14"
6564
}
6665
}

pages/_app.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { AppProps /* , AppContext */ } from 'next/app';
2-
3-
import 'styles/globals.css';
1+
import '@/styles/globals.css';
2+
import type { AppProps /* , AppContext */ } from 'next/app';
43

54
function App({ Component, pageProps }: AppProps) {
65
return <Component {...pageProps} />;

pages/_document.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Html, Head, Main, NextScript } from 'next/document';
2+
3+
export default function Document() {
4+
return (
5+
<Html lang="en">
6+
<Head />
7+
<body>
8+
<Main />
9+
<NextScript />
10+
</body>
11+
</Html>
12+
);
13+
}

pages/api/hello.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { NextApiRequest, NextApiResponse } from 'next';
1+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2+
import type { NextApiRequest, NextApiResponse } from 'next';
23

34
type Data = {
45
name: string;
56
};
67

7-
export default function Main(_: NextApiRequest, res: NextApiResponse<Data>) {
8+
export default function handler(_: NextApiRequest, res: NextApiResponse<Data>) {
89
res.status(200).json({ name: 'John Doe' });
910
}

pages/index.tsx

+92-72
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,123 @@
11
import Image from 'next/image';
2+
import { Inter } from 'next/font/google';
23

3-
import Nav from 'components/nav';
4+
import Nav from '@/components/nav';
45

5-
export default function Main() {
6+
const inter = Inter({ subsets: ['latin'] });
7+
8+
export default function Home() {
69
return (
7-
<div className="min-h-screen px-2 py-0 flex flex-col justify-center items-center">
10+
<>
811
<Nav />
9-
<main className="px-0 py-20 flex flex-1 flex-col justify-center items-center">
10-
<h1 className="text-4xl mb-3 text-center">
11-
Welcome to{' '}
12-
<a
13-
href="https://nextjs.org"
14-
className="text-blue-600 no-underline hover:underline focus:underline active:underline"
15-
>
16-
Next.js
17-
</a>
18-
{' + '}
19-
<a
20-
href="https://www.typescriptlang.org/"
21-
className="text-blue-600 no-underline hover:underline focus:underline active:underline"
22-
>
23-
Typescript
24-
</a>
25-
{' + '}
26-
<a
27-
href="https://tailwindcss.com/"
28-
className="text-blue-600 no-underline hover:underline focus:underline active:underline"
29-
>
30-
Tailwind CSS!
31-
</a>
32-
</h1>
12+
<main
13+
className={`flex min-h-screen flex-col items-center justify-between p-24 ${inter.className}`}
14+
>
15+
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
16+
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
17+
Get started by editing&nbsp;
18+
<code className="font-mono font-bold">pages/index.tsx</code>
19+
</p>
20+
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
21+
<a
22+
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
23+
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
24+
target="_blank"
25+
rel="noopener noreferrer"
26+
>
27+
By{' '}
28+
<Image
29+
src="/vercel.svg"
30+
alt="Vercel Logo"
31+
className="dark:invert"
32+
width={100}
33+
height={24}
34+
priority
35+
/>
36+
</a>
37+
</div>
38+
</div>
3339

34-
<p className="text-xl text-center">
35-
Get started by editing{' '}
36-
<code className="bg-gray-50 rounded-md p-3 text-base font-mono">
37-
pages/index.tsx
38-
</code>
39-
</p>
40+
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700/10 after:dark:from-sky-900 after:dark:via-[#0141ff]/40 before:lg:h-[360px]">
41+
<Image
42+
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
43+
src="/next.svg"
44+
alt="Next.js Logo"
45+
width={180}
46+
height={37}
47+
priority
48+
/>
49+
</div>
4050

41-
<div className="flex flex-wrap justify-center items-center max-w-screen-md mt-12 sm:w-full">
51+
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-4 lg:text-left">
4252
<a
43-
href="https://nextjs.org/docs"
44-
className="w-72 flex-grow flex-shrink-0 m-4 p-5 text-left no-underline border border-gray-200 rounded-xl transition duration-500 ease-in-out transform hover:text-blue-600 hover:border-2 hover:border-blue-600 focus:text-blue-600 focus:border-blue-600 active:text-blue-600 active:border-blue-600"
53+
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
54+
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
55+
target="_blank"
56+
rel="noopener noreferrer"
4557
>
46-
<h3 className="mb-4 text-xl">Documentation &rarr;</h3>
47-
<p className="text-xl">
58+
<h2 className={`mb-3 text-2xl font-semibold`}>
59+
Docs{' '}
60+
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
61+
-&gt;
62+
</span>
63+
</h2>
64+
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
4865
Find in-depth information about Next.js features and API.
4966
</p>
5067
</a>
5168

5269
<a
53-
href="https://nextjs.org/learn"
54-
className="w-72 flex-grow flex-shrink-0 m-4 p-5 text-left no-underline border border-gray-200 rounded-xl transition duration-500 ease-in-out transform hover:text-blue-600 hover:border-2 hover:border-blue-600 focus:text-blue-600 focus:border-blue-600 active:text-blue-600 active:border-blue-600"
70+
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
71+
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
72+
target="_blank"
73+
rel="noopener noreferrer"
5574
>
56-
<h3 className="mb-4 text-xl">Learn &rarr;</h3>
57-
<p className="text-xl">
58-
Learn about Next.js in an interactive course with quizzes!
75+
<h2 className={`mb-3 text-2xl font-semibold`}>
76+
Learn{' '}
77+
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
78+
-&gt;
79+
</span>
80+
</h2>
81+
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
82+
Learn about Next.js in an interactive course with&nbsp;quizzes!
5983
</p>
6084
</a>
6185

6286
<a
63-
href="https://github.com/vercel/next.js/tree/master/examples"
64-
className="w-72 flex-grow flex-shrink-0 m-4 p-5 text-left no-underline border border-gray-200 rounded-xl transition duration-500 ease-in-out transform hover:text-blue-600 hover:border-2 hover:border-blue-600 focus:text-blue-600 focus:border-blue-600 active:text-blue-600 active:border-blue-600"
87+
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
88+
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
89+
target="_blank"
90+
rel="noopener noreferrer"
6591
>
66-
<h3 className="mb-4 text-xl">Examples &rarr;</h3>
67-
<p className="text-xl">
68-
Discover and deploy boilerplate example Next.js projects.
92+
<h2 className={`mb-3 text-2xl font-semibold`}>
93+
Templates{' '}
94+
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
95+
-&gt;
96+
</span>
97+
</h2>
98+
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
99+
Discover and deploy boilerplate example Next.js&nbsp;projects.
69100
</p>
70101
</a>
71102

72103
<a
73-
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
74-
className="w-72 flex-grow flex-shrink-0 m-4 p-5 text-left no-underline border border-gray-200 rounded-xl transition duration-500 ease-in-out transform hover:text-blue-600 hover:border-2 hover:border-blue-600 focus:text-blue-600 focus:border-blue-600 active:text-blue-600 active:border-blue-600"
104+
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
105+
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
106+
target="_blank"
107+
rel="noopener noreferrer"
75108
>
76-
<h3 className="mb-4 text-xl">Deploy &rarr;</h3>
77-
<p className="text-xl">
78-
Instantly deploy your Next.js site to a public URL with Vercel.
109+
<h2 className={`mb-3 text-2xl font-semibold`}>
110+
Deploy{' '}
111+
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
112+
-&gt;
113+
</span>
114+
</h2>
115+
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
116+
Instantly deploy your Next.js site to a shareable URL with Vercel.
79117
</p>
80118
</a>
81119
</div>
82120
</main>
83-
84-
<footer className="w-full h-24 border-gray-200 border-t-2 flex justify-center items-center">
85-
<a
86-
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
87-
target="_blank"
88-
rel="noopener noreferrer"
89-
className="flex items-center justify-center"
90-
>
91-
Powered by{' '}
92-
<Image
93-
src="/vercel.svg"
94-
alt="Vercel Logo"
95-
className="h-4 ml-2"
96-
width={70}
97-
height={70}
98-
/>
99-
</a>
100-
</footer>
101-
</div>
121+
</>
102122
);
103123
}

public/favicon.ico

10.6 KB
Binary file not shown.

public/next.svg

+1
Loading

public/vercel.svg

+1-4
Loading

styles/globals.css

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4+
5+
:root {
6+
--foreground-rgb: 0, 0, 0;
7+
--background-start-rgb: 214, 219, 220;
8+
--background-end-rgb: 255, 255, 255;
9+
}
10+
11+
@media (prefers-color-scheme: dark) {
12+
:root {
13+
--foreground-rgb: 255, 255, 255;
14+
--background-start-rgb: 0, 0, 0;
15+
--background-end-rgb: 0, 0, 0;
16+
}
17+
}
18+
19+
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));
27+
}

tailwind.config.js

-14
This file was deleted.

tailwind.config.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { Config } from 'tailwindcss';
2+
3+
const config: Config = {
4+
content: [
5+
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
6+
'./components/**/*.{js,ts,jsx,tsx,mdx}',
7+
'./app/**/*.{js,ts,jsx,tsx,mdx}',
8+
],
9+
theme: {
10+
extend: {
11+
backgroundImage: {
12+
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
13+
'gradient-conic':
14+
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
15+
},
16+
},
17+
},
18+
plugins: [],
19+
};
20+
export default config;

0 commit comments

Comments
 (0)