Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit 29e4929

Browse files
committed
added example pages
1 parent bf4aa3f commit 29e4929

File tree

6 files changed

+44
-358
lines changed

6 files changed

+44
-358
lines changed

configs/publicRuntimeConfig.js

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,29 +1 @@
1-
const { name, keywords } = require('../package.json');
2-
3-
const staticOptimization = true;
4-
const displayName = 'Nextjs_Ts_Eslint';
5-
const themeColor = 'red';
6-
const png192Path = '/static/icons/icon192x192.png';
7-
const png512Path = '/static/icons/icon512x512.png';
8-
const favIconPath = '/static/icons/favicon.ico';
9-
10-
const isProd = process.env.NODE_ENV === 'production';
11-
const prodAssetPrefix = '/' + name;
12-
const serviceWorkerFilename = 'service-worker.js';
13-
const commonKeywords = keywords.join(',');
14-
const manifestPath = '/static/manifest.json';
15-
16-
module.exports = {
17-
linkPrefix: isProd ? prodAssetPrefix : '',
18-
isProd,
19-
prodAssetPrefix,
20-
serviceWorkerFilename,
21-
displayName,
22-
themeColor,
23-
commonKeywords,
24-
staticOptimization,
25-
png192Path,
26-
png512Path,
27-
favIconPath,
28-
manifestPath,
29-
};
1+
module.exports = {};

next-env.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Nextjs_Ts_Eslint",
33
"version": "1.0.0",
4-
"description": "Github PWA Project Setup with NextJs, Typescript, Redux, AMP etc.",
4+
"description": "Example Project Setup with NextJs, Typescript, Eslint, Jest and Emotion.",
55
"main": "index.js",
66
"scripts": {
77
"dev": "next",
@@ -11,8 +11,7 @@
1111
"test:watch": "jest --watch",
1212
"test:coverage": "jest --coverage",
1313
"help": "next export -h",
14-
"export": "npm run build && next export",
15-
"deploy": "NODE_ENV=production npm run build && next export -o docs && touch docs/.nojekyll"
14+
"export": "npm run build && next export"
1615
},
1716
"repository": {
1817
"type": "git",

pages/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { NextPage } from 'next';
3+
4+
const IndexPage: NextPage = () => <div>hello index</div>;
5+
6+
export default IndexPage;

pages/index/[id].tsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { GetStaticProps, GetStaticPaths, NextPage } from 'next';
3+
import { useRouter } from 'next/router';
4+
5+
export interface Props {
6+
id?: string;
7+
}
8+
9+
const IndexPage: NextPage<Props> = ({ id }) => {
10+
const router = useRouter();
11+
return (
12+
<div>
13+
Param:
14+
{router.isFallback ? 'Hold on' : id}
15+
</div>
16+
);
17+
};
18+
19+
export const getStaticProps: GetStaticProps<Props> = async ({ params }) => {
20+
return { props: params ?? {} };
21+
};
22+
23+
export const getStaticPaths: GetStaticPaths = async () => ({
24+
paths: [{ params: { id: '1' } }],
25+
fallback: true,
26+
});
27+
export default IndexPage;

0 commit comments

Comments
 (0)