Skip to content

Commit 414c7fb

Browse files
author
zhiwen.zhao
committed
docs: update docs
1 parent cbc73a2 commit 414c7fb

File tree

12 files changed

+31
-28
lines changed

12 files changed

+31
-28
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
template/
22
*.js
3-
**/demo
3+
**/demo/
4+
**/__tests__/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
/dist
1717
/lib
1818
/esm
19-
/.docz
2019
/doc-site
2120
/types
2221

.umirc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineConfig } from 'dumi';
44
let base = '/react-ui-library-tutorial';
55
let publicPath = '/react-ui-library-tutorial/';
66

7-
if (process.env.DOC_BUILD_ENV === 'local') {
7+
if (process.env.SITE_BUILD_ENV === 'PREVIEW') {
88
base = undefined;
99
publicPath = undefined;
1010
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
于是在部门内搭了一个简单的组件库,组件不多,但在搭建过程中掌握了很多知识,再看 antd 等热门组件库,对其中的一些设计也有了更深的感悟,故记录下来,希望能帮助到其他的同学。
1616

17-
[🚀 在线预览](https://happy-ui.now.sh)
17+
[🚀 在线预览](https://worldzhao.github.io/react-ui-library-tutorial)
1818

1919
🚆 本地预览
2020

@@ -27,15 +27,15 @@ yarn start
2727

2828
按顺序执行完命令后,即可在 localhost:3000 端口看到以下内容:
2929

30-
![preview](https://raw.githubusercontent.com/worldzhao/blog/master/images/rc-lib-1.jpg)
30+
![preview](https://raw.githubusercontent.com/worldzhao/blog/master/images/rc-lib-v1-1.jpg)
3131

3232
## 概览
3333

3434
本系列文章主要包含以下内容:
3535

3636
- 项目初始化: 组件库前期开发准备工作。`eslint`/`commit lint`/`typescript`等等;
37-
- 开发阶段: 使用[docz](https://github.com/doczjs/docz)进行开发调试以及文档编写;
37+
- 开发阶段: 使用[dumi](https://d.umijs.org/zh-CN)进行开发调试以及文档编写;
3838
- 打包阶段: 输出~~`umd`~~/`cjs`/`esm`产物并支持按需加载;
3939
- 组件测试: 使用`@testing-library/react`及其相关生态进行组件测试;
40-
- 发布 npm: 编写脚本完成自动化发布
41-
- 部署文档站点: 使用[now](https://zeit.co/home)部署文档站点
40+
- 发布 npm: 编写脚本完成发布或直接使用 [np](https://www.npmjs.com/package/np) 发布
41+
- 部署文档站点: 使用 Github Pages 以及 Github Actions 完成文档站点自动部署

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ nav:
1111
**使用 npm 或 yarn 安装**
1212

1313
```shell
14-
$ npm install @zzzzw/happy-ui --save
14+
npm install @zzzzw/happy-ui
1515
```
1616

1717
```shell

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"dev": "dumi dev",
2323
"start": "npm run dev",
2424
"build:site": "rimraf doc-site && dumi build",
25-
"preview:site": "cross-env DOC_BUILD_ENV=local npm run build:site && serve doc-site",
25+
"preview:site": "cross-env SITE_BUILD_ENV=PREVIEW npm run build:site && serve doc-site",
2626
"deploy:site": "npm run build:site && gh-pages -d doc-site",
2727
"clean": "rimraf lib esm dist",
2828
"build:types": "tsc -p tsconfig.build.json && cpr lib esm",

src/alert/__tests__/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { render } from '@testing-library/react';
3-
import Alert from '../alert';
3+
import Alert from '..';
44

55
describe('<Alert />', () => {
66
test('should render default', () => {

src/alert/demo/basic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import Alert from '../alert';
2+
import Alert from '../';
33
import '../style';
44

55
export default () => <Alert kind="warning">这是一条警告提示</Alert>;

src/alert/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,14 @@ group:
88
order: 1
99
---
1010

11+
# Alert 警告提示
12+
13+
警告提示,展现需要关注的信息。
14+
15+
## 代码演示
16+
17+
### 基本用法
18+
1119
<code src="./demo/basic.tsx"></code>
20+
21+
<API src="./index.tsx"></API>

src/alert/index.ts

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

src/alert/alert.tsx renamed to src/alert/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import React from 'react';
22
import t from 'prop-types';
33

4-
import { AlertProps, KindMap } from './interface';
4+
export interface AlertProps {
5+
/**
6+
* @description Alert 的类型
7+
* @default 'info'
8+
*/
9+
kind?: 'info' | 'positive' | 'negative' | 'warning';
10+
}
11+
12+
export type KindMap = Record<Required<AlertProps>['kind'], string>;
513

614
const prefixCls = 'happy-alert';
715

src/alert/interface.ts

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

0 commit comments

Comments
 (0)