Skip to content

Commit 509ba36

Browse files
committed
chore: init
1 parent 568ad3f commit 509ba36

File tree

13 files changed

+287
-0
lines changed

13 files changed

+287
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/npm-debug.log*
6+
/yarn-error.log
7+
/yarn.lock
8+
/package-lock.json
9+
10+
# production
11+
/dist
12+
13+
# misc
14+
.DS_Store
15+
16+
# umi
17+
/src/.umi
18+
/src/.umi-production
19+
/src/.umi-test
20+
/.env.local

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/*.md
2+
**/*.svg
3+
**/*.ejs
4+
**/*.html
5+
package.json
6+
.umi
7+
.umi-production
8+
.umi-test

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 80,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

.umirc.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig } from 'umi';
2+
3+
export default defineConfig({
4+
nodeModulesTransform: {
5+
type: 'none',
6+
},
7+
fastRefresh: {},
8+
9+
antd: {},
10+
11+
// plugins
12+
layout: {
13+
name: 'CNode.js',
14+
locale: false,
15+
},
16+
17+
routes: [{ path: '/', component: '@/pages/index' }],
18+
});

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
# react-cnode
2+
23
CNode 社区 React 版本
4+
5+
## Getting Started
6+
7+
Install dependencies,
8+
9+
```bash
10+
$ yarn
11+
```
12+
13+
Start the dev server,
14+
15+
```bash
16+
$ yarn start
17+
```

mock/.gitkeep

Whitespace-only changes.

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "umi dev",
5+
"build": "umi build",
6+
"postinstall": "umi generate tmp",
7+
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
8+
"test": "umi-test",
9+
"test:coverage": "umi-test --coverage"
10+
},
11+
"gitHooks": {
12+
"pre-commit": "lint-staged"
13+
},
14+
"lint-staged": {
15+
"*.{js,jsx,less,md,json}": [
16+
"prettier --write"
17+
],
18+
"*.ts?(x)": [
19+
"prettier --parser=typescript --write"
20+
]
21+
},
22+
"dependencies": {
23+
"@ant-design/pro-card": "^1.18.20",
24+
"@ant-design/pro-layout": "^6.32.1",
25+
"react": "17.x",
26+
"react-dom": "17.x",
27+
"umi": "^3.5.20"
28+
},
29+
"devDependencies": {
30+
"@types/react": "^17.0.0",
31+
"@types/react-dom": "^17.0.0",
32+
"@umijs/preset-react": "1.x",
33+
"@umijs/test": "^3.5.20",
34+
"lint-staged": "^10.0.7",
35+
"prettier": "^2.2.0",
36+
"typescript": "^4.1.2",
37+
"yorkie": "^2.0.0"
38+
}
39+
}

src/app.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
import { Avatar } from 'antd';
3+
import { UserOutlined } from '@ant-design/icons';
4+
5+
import {
6+
BasicLayoutProps,
7+
Settings as LayoutSettings,
8+
} from '@ant-design/pro-layout';
9+
10+
export async function getInitialState() {
11+
return {
12+
currentUser: 'Suyi',
13+
};
14+
}
15+
16+
export const layout = ({
17+
initialState,
18+
}: {
19+
initialState: { settings?: LayoutSettings };
20+
}): BasicLayoutProps => {
21+
return {
22+
// rightContentRender: () => <RightContent />,
23+
// footerRender: () => <Footer />,
24+
onPageChange: () => {
25+
// const { currentUser } = initialState;
26+
// const { location } = history;
27+
// 如果没有登录,重定向到 login
28+
// if (!currentUser && location.pathname !== '/user/login') {
29+
// history.push('/user/login');
30+
// }
31+
},
32+
// menuHeaderRender: undefined,
33+
rightContentRender: () => {
34+
return (
35+
<div>
36+
<Avatar shape="square" size="small" icon={<UserOutlined />} />
37+
</div>
38+
);
39+
},
40+
41+
layout: 'top',
42+
navTheme: 'light',
43+
headerHeight: 64,
44+
};
45+
};

src/pages/index.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.title {
2+
background: rgb(121, 242, 157);
3+
}

0 commit comments

Comments
 (0)