Skip to content

Commit 7622c05

Browse files
committed
feat: add home page
1 parent cb25137 commit 7622c05

File tree

16 files changed

+290
-255
lines changed

16 files changed

+290
-255
lines changed

config/basic.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
logo: '//static2.cnodejs.org/public/images/cnodejs_light.svg',
23
title: 'CNode.js',
3-
description: 'Node.js专业中文社区',
4+
description: 'Node.js 专业中文社区',
45
};

config/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default defineConfig({
1414

1515
antd: {},
1616

17+
theme: {
18+
'@primary-color': '#1DA57A',
19+
},
20+
1721
dva: {
1822
immer: true,
1923
},

config/routes.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const routes: IRoute[] = [
55
path: '/',
66
exact: true,
77
icon: 'home',
8-
name: 'Home',
9-
title: '主页',
8+
name: '主页',
109
component: '@/page/home',
11-
// access: 'canReadCommon',
10+
wrappers: ['@/layout/index'],
1211
hideInNav: false,
1312
hideInMenu: false,
1413
},

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@ant-design/icons": "^4.7.0",
2929
"@ant-design/pro-card": "^1.18.20",
3030
"@ant-design/pro-layout": "^6.32.1",
31+
"@ant-design/pro-list": "^1.21.12",
3132
"@ant-design/pro-table": "^2.61.9",
3233
"@types/dotenv": "^8.2.0",
3334
"@types/react": "^17.0.0",
@@ -37,6 +38,7 @@
3738
"@umijs/preset-react": "1.x",
3839
"@umijs/test": "^3.5.20",
3940
"ahooks": "^3.1.3",
41+
"dayjs": "^1.10.7",
4042
"lint-staged": "^10.0.7",
4143
"prettier": "^2.2.0",
4244
"typescript": "^4.1.2",

src/app.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import React from 'react';
2+
3+
import dayjs from 'dayjs';
4+
import relativeTime from 'dayjs/plugin/relativeTime';
5+
import 'dayjs/locale/zh';
6+
27
import { MicroApp, IRoute, request as requestClient, RequestConfig } from 'umi';
38
import { PageContainer } from '@ant-design/pro-layout';
49
import { BASE_URL } from './constants';
510
import proLayout from './proLayout';
611

12+
dayjs.locale('zh');
13+
dayjs.extend(relativeTime);
14+
715
const qiankunApps: Array<QiankunApp> = [];
816

917
export async function getInitialState() {

src/component/Brand/index.module.less

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
align-items: baseline;
44
}
55

6+
.logo {
7+
}
8+
69
.title {
7-
color: #829a82;
10+
color: rgba(0, 0, 0, 0.85);
811
margin: 0;
9-
padding: 0;
12+
padding: 0 4px;
1013
}
1114

1215
.description {
13-
color: #8264ff;
16+
color: #222;
1417
opacity: 0.55;
1518
margin: 0 0 0 0.4em;
19+
padding: 0 4px;
1620
}

src/component/Brand/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
22
import * as styles from './index.module.less';
33

4-
const Brand: React.FC<Props> = ({ title, description }) => (
4+
const Brand: React.FC<Props> = ({ logo, title, description }) => (
55
<div className={styles.container}>
6+
<img className={styles.logo} src={logo} alt="logo" />
67
<h1 className={styles.title}>{title}</h1>
78
<p className={styles.description}>{description}</p>
89
</div>
@@ -13,4 +14,5 @@ export default Brand;
1314
interface Props {
1415
title: string;
1516
description: string;
17+
logo?: string;
1618
}

src/component/Logo/index.module.less

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/component/Logo/index.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.list {
2+
:global {
3+
.ant-card {
4+
padding: 0;
5+
> .ant-card-body {
6+
padding: 0;
7+
}
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)