Skip to content

Commit 0bd3b9a

Browse files
committed
init project
1 parent 2753dfd commit 0bd3b9a

40 files changed

+10908
-3699
lines changed

Diff for: .eslintrc.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": "next/core-web-vitals",
3+
"rules": {
4+
"react/display-name": "off"
5+
}
36
}

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ yarn-error.log*
3333

3434
# typescript
3535
*.tsbuildinfo
36-
next-env.d.ts

Diff for: .idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: README.md

+12-37
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,19 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped
2-
with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
# A Demo for 《SSR 实战:官网开发指南》
32

4-
## Getting Started
3+
《SSR 实战:官网开发指南》实战篇 教学代码
54

6-
First, run the development server:
5+
## 项目启动
76

8-
```bash
7+
1. fork cms 数据层仓库 https://github.com/czm1290433700/nextjs-cms 参照对应 readme 启动
8+
2. nextjs-demo 启动
9+
10+
```
11+
npm install
912
npm run dev
10-
# or
11-
yarn dev
1213
```
1314

14-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
15-
16-
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
17-
18-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed
19-
on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited
20-
in `pages/api/hello.ts`.
21-
22-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated
23-
as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
24-
25-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and
26-
load Inter, a custom Google Font.
27-
28-
## Learn More
15+
## 项目调试
2916

30-
To learn more about Next.js, take a look at the following resources:
31-
32-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
33-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
34-
35-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions
36-
are welcome!
37-
38-
## Deploy on Vercel
39-
40-
The easiest way to deploy your Next.js app is to use
41-
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)
42-
from the creators of Next.js.
43-
44-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
17+
```
18+
npm run debugger
19+
```

Diff for: commitlint.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"type-enum": [2, "always", ["feat", "fix", "revert"]],
5+
"subject-max-length": [1, "always", 30],
6+
},
7+
};

Diff for: components/footer/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export const Footer: FC<IFooterProps> = ({
7979
<Image
8080
src={qrCode?.image}
8181
alt={qrCode?.text}
82-
width={80}
83-
height={80}
82+
width={56}
83+
height={56}
8484
></Image>
8585
</div>
8686
<div className={styles.text}>{qrCode?.text}</div>

Diff for: components/footer/styles.module.scss

+91-26
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,156 @@
1+
@import "../../pages/media.scss";
2+
13
.footer {
2-
padding: 70px 145px;
3-
background-color: #1f1f1f;
4+
font-size: 1rem;
5+
padding: 4.375rem 9.0625rem;
6+
background-color: var(--footer-background-color);
47

58
.topArea {
69
display: flex;
710
justify-content: space-between;
11+
flex-wrap: wrap;
812

913
.footerTitle {
1014
font-weight: 500;
11-
font-size: 36px;
12-
line-height: 36px;
13-
color: #ffffff;
15+
font-size: 2.25rem;
16+
line-height: 2.25rem;
17+
color: var(--primary-color);
1418
margin: 0;
1519
}
1620

1721
.linkListArea {
1822
display: flex;
19-
2023
.linkArea {
2124
display: flex;
2225
flex-direction: column;
23-
margin-left: 160px;
26+
margin-left: 10rem;
2427

2528
.title {
2629
font-weight: 500;
27-
font-size: 14px;
28-
line-height: 20px;
29-
color: #ffffff;
30-
margin-bottom: 40px;
30+
font-size: 0.875rem;
31+
line-height: 1.25rem;
32+
color: var(--primary-color);
33+
margin-bottom: 2.5rem;
34+
word-break: keep-all;
3135
}
3236

3337
.links {
3438
display: flex;
3539
flex-direction: column;
3640
font-weight: 400;
37-
font-size: 14px;
38-
line-height: 20px;
41+
font-size: 0.875rem;
42+
line-height: 1.25rem;
43+
word-break: keep-all;
3944

4045
.link {
41-
color: #ffffff;
46+
color: var(--primary-color);
4247
cursor: pointer;
43-
margin-bottom: 24px;
48+
margin-bottom: 1.5rem;
4449
}
4550

4651
.disabled {
47-
color: #666;
52+
color: var(--secondary-color);
4853
cursor: not-allowed;
49-
margin-bottom: 24px;
54+
margin-bottom: 1.5rem;
5055
}
5156
}
5257
}
58+
59+
.linkArea:first-of-type {
60+
margin-left: 0;
61+
}
5362
}
5463
}
5564

5665
.bottomArea {
5766
display: flex;
5867
justify-content: space-between;
59-
6068
.codeArea {
6169
display: flex;
6270
flex-direction: column;
63-
6471
.text {
65-
color: #ffffff;
72+
color: var(--secondary-color);
6673
}
6774
}
68-
6975
.numArea {
70-
color: #ffffff;
76+
color: var(--secondary-color);
7177
display: flex;
7278
flex-direction: column;
7379
align-items: flex-end;
7480
font-weight: 400;
75-
font-size: 14px;
76-
line-height: 20px;
81+
font-size: 0.875rem;
82+
line-height: 1.25rem;
7783

7884
span {
79-
margin-bottom: 12px;
85+
margin-bottom: 0.75rem;
8086
}
8187

8288
.publicLogo {
8389
display: flex;
8490

8591
.logo {
86-
margin-right: 4px;
92+
margin-right: 0.25rem;
8793
}
8894
}
8995
}
9096
}
9197
}
98+
99+
@media screen and (min-width: 48.6875rem) and (max-width: 54.125rem) {
100+
.footer {
101+
.topArea {
102+
.footerTitle {
103+
margin-bottom: 1.25rem;
104+
}
105+
}
106+
}
107+
}
108+
109+
@media screen and (max-width: 48.6875rem) {
110+
.footer {
111+
.topArea {
112+
display: flex;
113+
flex-direction: column;
114+
align-items: center;
115+
116+
.footerTitle {
117+
margin-bottom: 2.5rem;
118+
}
119+
120+
.linkListArea {
121+
display: flex;
122+
flex-direction: column;
123+
text-align: center;
124+
125+
.linkArea {
126+
margin-left: 0;
127+
}
128+
}
129+
}
130+
131+
.bottomArea {
132+
display: flex;
133+
flex-direction: column;
134+
align-items: center;
135+
136+
.codeArea {
137+
display: flex;
138+
flex-direction: column;
139+
align-items: center;
140+
141+
.text {
142+
text-align: center;
143+
margin: 1.25rem 0;
144+
}
145+
}
146+
147+
.numArea {
148+
align-items: center;
149+
text-align: center;
150+
}
151+
}
152+
}
153+
}
154+
155+
// @include media-ipad {
156+
// }

Diff for: components/layout/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {FC} from "react";
2-
import {Footer, IFooterProps} from "../footer";
3-
import {INavBarProps, NavBar} from "../navbar";
2+
import {Footer, IFooterProps} from "../footer/index";
3+
import {INavBarProps, NavBar} from "../navbar/index";
44
import styles from "./styles.module.scss";
55

66
export interface ILayoutProps {

Diff for: components/layout/styles.module.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.layout {
2+
background-color: var(--primary-background-color);
3+
24
.main {
3-
min-height: calc(100vh - 560px);
5+
min-height: calc(100vh - 34.85rem);
46
}
57
}

Diff for: components/navbar/index.tsx

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
1-
import {FC} from "react";
1+
import {FC, useContext} from "react";
22
import styles from "./styles.module.scss";
33
import Image from "next/image";
44
import logoIcon from "@/public/logo-icon.svg";
55
import logoText from "@/public/logo-text.svg";
6+
import {ThemeContext} from "@/stores/theme";
7+
import {Themes} from "@/constants/enum";
68

79
export interface INavBarProps {
810
}
911

1012
export const NavBar: FC<INavBarProps> = ({}) => {
13+
const {setTheme} = useContext(ThemeContext);
1114
return (
1215
<div className={styles.navBar}>
1316
<a href="http://localhost:3000/">
1417
<Image src={logoIcon} alt="Demo" width={35} height={35}/>
1518
<Image src={logoText} alt="Demo" width={135} height={40}/>
1619
</a>
20+
<div className={styles.themeArea}>
21+
<div
22+
className={styles.popupText}
23+
>
24+
弹窗示范
25+
</div>
26+
<div
27+
className={styles.themeIcon}
28+
onClick={(): void => {
29+
if (localStorage.getItem("theme") === Themes.light) {
30+
setTheme(Themes.dark);
31+
} else {
32+
setTheme(Themes.light);
33+
}
34+
}}
35+
></div>
36+
</div>
1737
</div>
1838
);
1939
};

0 commit comments

Comments
 (0)