Skip to content

Commit 574e242

Browse files
committed
docs: update
1 parent 3ea5214 commit 574e242

File tree

56 files changed

+417
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+417
-347
lines changed

.dumi/theme/_utils.ts

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

.dumi/theme/builtins/Previewer.tsx

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

.dumi/theme/layout.tsx

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

.dumi/theme/layouts/GlobalLayout.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// .dumi/theme/layouts/GlobalLayout.tsx
2+
import React from 'react';
3+
import { ConfigProvider, theme } from 'antd';
4+
import { useOutlet, usePrefersColor } from 'dumi';
5+
6+
const GlobalLayout: React.FC = () => {
7+
const outlet = useOutlet();
8+
// color 为当前应用的主题色,dark or light
9+
const [color] = usePrefersColor();
10+
11+
return (
12+
<ConfigProvider
13+
theme={{
14+
algorithm: color === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
15+
}}
16+
>
17+
{outlet}
18+
</ConfigProvider>
19+
);
20+
};
21+
22+
export default GlobalLayout;

.dumirc.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { defineConfig } from 'dumi';
2+
import { toNumber } from 'ut2';
3+
import { version, name } from './package.json';
4+
5+
const { BUILD_DOC_VERSION, NODE_ENV } = process.env;
6+
7+
const isDev = NODE_ENV === 'development';
8+
9+
const MajorVersion = toNumber(version.split('.')[0]);
10+
const PreviousVersion = MajorVersion - 1;
11+
12+
const serverRootDirect = isDev ? '/' : '/rc-hooks/';
13+
const gitVersionPath = BUILD_DOC_VERSION ? `refs/heads/v${MajorVersion}` : 'latest';
14+
const publicPath = serverRootDirect + gitVersionPath + '/';
15+
16+
const outputPath = 'site';
17+
18+
const logo = 'https://doly-dev.github.io/logo.png';
19+
const favicons = ['https://doly-dev.github.io/favicon.png'];
20+
21+
export default defineConfig({
22+
themeConfig: {
23+
name,
24+
logo,
25+
footer: 'doly-dev | Copyright © 2020-present',
26+
nav: [
27+
{
28+
title: '指南',
29+
link: '/guide'
30+
},
31+
{
32+
title: 'Hooks',
33+
link: '/hooks'
34+
},
35+
{
36+
title: 'GitHub',
37+
link: `https://github.com/doly-dev/${name}`
38+
},
39+
{
40+
title: '更新日志',
41+
link: `https://github.com/doly-dev/${name}/releases`
42+
},
43+
{
44+
title: `v${PreviousVersion}.x`,
45+
link: `https://doly-dev.github.io/rc-hooks/refs/heads/v${PreviousVersion}/index.html`
46+
}
47+
]
48+
},
49+
resolve: {
50+
atomDirs: [{ type: 'hooks', dir: 'src' }]
51+
},
52+
history: {
53+
type: 'hash'
54+
},
55+
hash: true,
56+
favicons,
57+
publicPath,
58+
outputPath,
59+
analytics: {
60+
ga_v2: 'G-P755RQJZZ2'
61+
}
62+
});

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- src/**
1313
- .umirc.js
1414
- .github/**
15+
- package.json
1516
- README.md
1617

1718
jobs:

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ module-config.js
1010
yarn.lock
1111
package-lock.json
1212
pnpm-lock.yaml
13-
.umi
14-
.umi-production
13+
.dumi/tmp
14+
.dumi/tmp-test
15+
.dumi/tmp-production
1516
example
1617
.DS_Store
1718
npm-debug.log*

.umirc.js

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

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,28 @@ import { useAsync } from 'rc-hooks';
5858
- [useSize] - 获取并监听 dom 节点的宽高
5959

6060
[site]: https://doly-dev.github.io/rc-hooks/latest/index.html
61-
[useasync]: https://doly-dev.github.io/rc-hooks/latest/index.html#/async/use-async
62-
[useloadmore]: https://doly-dev.github.io/rc-hooks/latest/index.html#/async/use-load-more
63-
[usepagination]: https://doly-dev.github.io/rc-hooks/latest/index.html#/async/use-pagination
64-
[usedebounce]: https://doly-dev.github.io/rc-hooks/latest/index.html#/side-effect/use-debounce
65-
[usethrottle]: https://doly-dev.github.io/rc-hooks/latest/index.html#/side-effect/use-throttle
66-
[usedebouncefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/side-effect/use-debounce-fn
67-
[usethrottlefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/side-effect/use-throttle-fn
68-
[usesetstate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/state/use-set-state
69-
[useprevious]: https://doly-dev.github.io/rc-hooks/latest/index.html#/state/use-previous
70-
[usesafestate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/state/use-safe-state
71-
[uselatest]: https://doly-dev.github.io/rc-hooks/latest/index.html#/state/use-latest
72-
[uselimitlist]: https://doly-dev.github.io/rc-hooks/latest/index.html#/state/use-limit-list
73-
[usemount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-mount
74-
[usemountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-mounted-ref
75-
[useupdate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-update
76-
[useunmount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-unmount
77-
[useunmountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-unmounted-ref
78-
[useupdateeffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-update-effect
79-
[useupdatelayouteffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/life-cycle/use-update-layout-effect
80-
[usepersistfn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/other/use-persist-fn
81-
[useclickaway]: https://doly-dev.github.io/rc-hooks/latest/index.html#/other/use-click-away
82-
[usesize]: https://doly-dev.github.io/rc-hooks/latest/index.html#/other/use-size
83-
[usecontrollablevalue]: https://doly-dev.github.io/rc-hooks/latest/index.html#/other/use-controllable-value
61+
[useasync]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-async
62+
[useloadmore]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-load-more
63+
[usepagination]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-pagination
64+
[usedebounce]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-debounce
65+
[usethrottle]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-throttle
66+
[usedebouncefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-debounce-fn
67+
[usethrottlefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-throttle-fn
68+
[usesetstate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-set-state
69+
[useprevious]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-previous
70+
[usesafestate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-safe-state
71+
[uselatest]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-latest
72+
[uselimitlist]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-limit-list
73+
[usemount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-mount
74+
[usemountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-mounted-ref
75+
[useupdate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update
76+
[useunmount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-unmount
77+
[useunmountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-unmounted-ref
78+
[useupdateeffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update-effect
79+
[useupdatelayouteffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update-layout-effect
80+
[usepersistfn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-persist-fn
81+
[useclickaway]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-click-away
82+
[usesize]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-size
83+
[usecontrollablevalue]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-controllable-value
8484
[npm]: https://img.shields.io/npm/v/rc-hooks.svg
8585
[npm-url]: https://npmjs.com/package/rc-hooks

docs/guide/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 快速上手
2+
3+
<embed src="../../README.md#L2-L1000"></embed>

docs/hooks/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 总览
2+
3+
<embed src="../../README.md#L31-L1000"></embed>

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: rc-hooks - React Hooks Library.
3+
hero:
4+
title: rc-hooks
5+
description: React Hooks Library.
6+
actions:
7+
- text: 快速上手
8+
link: /docs
9+
---

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"lint:fix": "npm run lint -- --fix",
2121
"commit": "cz",
2222
"test": "jest --verbose",
23-
"prepare": "husky",
23+
"prepare": "husky && dumi setup",
2424
"prepublishOnly": "npm test && npm run build",
2525
"tsc": "tsc --noEmit"
2626
},
@@ -59,7 +59,6 @@
5959
},
6060
"devDependencies": {
6161
"@babel/core": "^7.26.0",
62-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
6362
"@babel/preset-env": "^7.26.0",
6463
"@babel/preset-react": "^7.25.9",
6564
"@babel/preset-typescript": "^7.26.0",
@@ -82,9 +81,7 @@
8281
"commitizen": "^4.3.1",
8382
"cross-env": "^7.0.3",
8483
"dayjs": "^1.11.13",
85-
"dumi": "^1.1.54",
86-
"dumi-theme-default": "^1.1.24",
87-
"element-remove": "^1.0.4",
84+
"dumi": "^2.4.17",
8885
"eslint": "^8.57.1",
8986
"eslint-plugin-react": "^7.37.2",
9087
"eslint-plugin-react-hooks": "^4.6.2",

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Async
22
export { default as useAsync } from './useAsync';
33
export * from './useAsync';
4-
export { default as useLoadMore } from './useAsync/useLoadMore';
5-
export * from './useAsync/useLoadMore';
6-
export { default as usePagination } from './useAsync/usePagination';
7-
export * from './useAsync/usePagination';
4+
export { default as useLoadMore } from './useLoadMore';
5+
export * from './useLoadMore';
6+
export { default as usePagination } from './usePagination';
7+
export * from './usePagination';
88

99
// SideEffect
1010
export { default as useDebounceFn } from './useDebounceFn';

0 commit comments

Comments
 (0)