Skip to content

Commit

Permalink
docs: Move to dumi (#331)
Browse files Browse the repository at this point in the history
* docs: init dumi

* docs: Move to dumi
  • Loading branch information
zombieJ authored Dec 28, 2021
1 parent 77a271d commit 13ca887
Show file tree
Hide file tree
Showing 32 changed files with 119 additions and 63 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ package-lock.json
coverage/
.doc
.history
# umi
.umi
.umi-production
.umi-test
.env.local
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ public
_site
.umi
.doc
.umi-production
.umi-test
19 changes: 19 additions & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

export default defineConfig({
title: 'rc-picker',
favicon:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
logo:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
outputPath: '.doc',
exportStatic: {},
styles: [
`
.markdown table {
width: auto !important;
}
`,
]
});
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ render(<Picker />, mountNode);
| getPopupContainer | function(trigger) | | to set the container of the floating layer, while the default is to create a div element in body |
| onChange | Function(date: moment, dateString: string) | | a callback function, can be executed when the selected time is changing |
| onOpenChange | Function(open:boolean) | | called when open/close picker |
| onFocus | (event:React.FocusEvent<HTMLInputElement>) => void | | called like input's on focus |
| onBlur | (event:React.FocusEvent<HTMLInputElement>) => void | | called like input's on blur |
| onKeyDown | (event:React.KeyboardEvent<HTMLInputElement>, preventDefault: () => void) => void | | input on keydown event |
| onFocus | (event:React.FocusEvent\<HTMLInputElement>) => void | | called like input's on focus |
| onBlur | (event:React.FocusEvent\<HTMLInputElement>) => void | | called like input's on blur |
| onKeyDown | (event:React.KeyboardEvent\<HTMLInputElement>, preventDefault: () => void) => void | | input on keydown event |
| direction | String: ltr or rtl | | Layout direction of picker component, it supports RTL direction too. |

### PickerPanel
Expand All @@ -103,7 +103,7 @@ render(<Picker />, mountNode);
| renderExtraFooter | (mode) => React.Node | | extra footer |
| onSelect | Function(date: moment) | | a callback function, can be executed when the selected time |
| onPanelChange | Function(value: moment, mode) | | callback when picker panel mode is changed |
| onMouseDown | (event:React.MouseEvent<HTMLInputElement>) => void | | callback when executed onMouseDown evnent |
| onMouseDown | (event:React.MouseEvent\<HTMLInputElement>) => void | | callback when executed onMouseDown evnent |
| direction | String: ltr or rtl | | Layout direction of picker component, it supports RTL direction too. |

### RangePicker
Expand Down
2 changes: 2 additions & 0 deletions docs/demo/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## basic
<code src="../examples/basic.tsx">
2 changes: 2 additions & 0 deletions docs/demo/calendar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## calendar
<code src="../examples/calendar.tsx">
2 changes: 2 additions & 0 deletions docs/demo/customize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## customize
<code src="../examples/customize.tsx">
2 changes: 2 additions & 0 deletions docs/demo/disabledDate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## disabledDate
<code src="../examples/disabledDate.tsx">
2 changes: 2 additions & 0 deletions docs/demo/modes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## modes
<code src="../examples/modes.tsx">
2 changes: 2 additions & 0 deletions docs/demo/panel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## panel
<code src="../examples/panel.tsx">
2 changes: 2 additions & 0 deletions docs/demo/panelRender.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## panelRender
<code src="../examples/panelRender.tsx">
2 changes: 2 additions & 0 deletions docs/demo/range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## range
<code src="../examples/range.tsx">
2 changes: 2 additions & 0 deletions docs/demo/rtl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## rtl
<code src="../examples/rtl.tsx">
2 changes: 2 additions & 0 deletions docs/demo/switchType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## switchType
<code src="../examples/switchType.tsx">
2 changes: 2 additions & 0 deletions docs/demo/uncontrolled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## uncontrolled
<code src="../examples/uncontrolled.tsx">
10 changes: 5 additions & 5 deletions examples/basic.tsx → docs/examples/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import type { Moment } from 'moment';
import moment from 'moment';
import Picker from '../src/Picker';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import enUS from '../src/locale/en_US';
import '../assets/index.less';
import Picker from '../../src/Picker';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import enUS from '../../src/locale/en_US';
import '../../assets/index.less';

// const defaultValue = moment('2019-09-03 05:02:03');
const defaultValue = moment('2019-11-28 01:02:03');
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions examples/calendar.tsx → docs/examples/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { Moment } from 'moment';
import Picker from '../src/Picker';
import PickerPanel from '../src/PickerPanel';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import Picker from '../../src/Picker';
import PickerPanel from '../../src/PickerPanel';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import './calendar.less';

function dateRender(date: Moment, today: Moment) {
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions examples/customize.tsx → docs/examples/customize.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import moment, { Moment } from 'moment';
import Picker from '../src';
import PickerPanel from '../src/PickerPanel';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import Picker from '../../src';
import PickerPanel from '../../src/PickerPanel';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import './slide.less';

interface DateRangeState {
Expand Down
8 changes: 4 additions & 4 deletions examples/disabledDate.tsx → docs/examples/disabledDate.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import type { Moment } from 'moment';
import moment from 'moment';
import Picker from '../src/Picker';
import momentGenerateConfig from '../src/generate/moment';
import enUS from '../src/locale/en_US';
import '../assets/index.less';
import Picker from '../../src/Picker';
import momentGenerateConfig from '../../src/generate/moment';
import enUS from '../../src/locale/en_US';
import '../../assets/index.less';

export default () => {
const [value, setValue] = React.useState<Moment | null>(undefined);
Expand Down
8 changes: 4 additions & 4 deletions examples/modes.tsx → docs/examples/modes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import moment, { Moment } from 'moment';
import RangePicker from '../src/RangePicker';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import RangePicker from '../../src/RangePicker';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import './common.less';

const defaultStartValue = moment('2019-09-03 05:02:03');
Expand Down
12 changes: 6 additions & 6 deletions examples/panel.tsx → docs/examples/panel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import moment, { Moment } from 'moment';
import PickerPanel from '../src/PickerPanel';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import enUS from '../src/locale/en_US';
import jaJP from '../src/locale/ja_JP';
import '../assets/index.less';
import PickerPanel from '../../src/PickerPanel';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import enUS from '../../src/locale/en_US';
import jaJP from '../../src/locale/ja_JP';
import '../../assets/index.less';

// const defaultValue = moment('2019-09-03 05:02:03');
const defaultValue = moment('2019-11-28 01:02:03');
Expand Down
10 changes: 5 additions & 5 deletions examples/panelRender.tsx → docs/examples/panelRender.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import moment, { Moment } from 'moment';
import Picker from '../src/Picker';
import RangePicker from '../src/RangePicker';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import Picker from '../../src/Picker';
import RangePicker from '../../src/RangePicker';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import './common.less';

const defaultStartValue = moment('2019-09-03 05:02:03');
Expand Down
8 changes: 4 additions & 4 deletions examples/range.tsx → docs/examples/range.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import type { Moment } from 'moment';
import moment from 'moment';
import RangePicker from '../src/RangePicker';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import RangePicker from '../../src/RangePicker';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import './common.less';

const defaultStartValue = moment('2019-09-03 05:02:03');
Expand Down
16 changes: 8 additions & 8 deletions examples/rtl.tsx → docs/examples/rtl.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import moment, { Moment } from 'moment';
import Picker from '../src/Picker';
import RangePicker from '../src/RangePicker';
import PickerPanel from '../src/PickerPanel';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import enUS from '../src/locale/en_US';
import jaJP from '../src/locale/ja_JP';
import '../assets/index.less';
import Picker from '../../src/Picker';
import RangePicker from '../../src/RangePicker';
import PickerPanel from '../../src/PickerPanel';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import enUS from '../../src/locale/en_US';
import jaJP from '../../src/locale/ja_JP';
import '../../assets/index.less';

const defaultValue = moment('2019-11-28 01:02:03');

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions examples/switchType.tsx → docs/examples/switchType.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react';
import { Moment } from 'moment';
import Picker from '../src/Picker';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import Picker from '../../src/Picker';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';

const sharedProps = {
generateConfig: momentGenerateConfig,
Expand Down
8 changes: 4 additions & 4 deletions examples/uncontrolled.tsx → docs/examples/uncontrolled.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { Moment } from 'moment';
import momentGenerateConfig from '../src/generate/moment';
import zhCN from '../src/locale/zh_CN';
import '../assets/index.less';
import Picker, { RangePicker } from '../src';
import momentGenerateConfig from '../../src/generate/moment';
import zhCN from '../../src/locale/zh_CN';
import '../../assets/index.less';
import Picker, { RangePicker } from '../../src';

export default () => (
<div>
Expand Down
3 changes: 2 additions & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"use": "@now/static-build",
"config": { "distDir": ".doc" }
}
]
],
"routes": [{ "src": "/(.*)", "dest": "/dist/$1" }]
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
},
"license": "MIT",
"scripts": {
"start": "cross-env NODE_ENV=development father doc dev --storybook",
"build": "father doc build --storybook",
"start": "dumi dev",
"build": "dumi build",
"compile": "father build && lessc assets/index.less assets/index.css",
"gh-pages": "npm run build && father doc deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
Expand Down Expand Up @@ -60,6 +60,7 @@
"@umijs/fabric": "^2.0.8",
"coveralls": "^3.0.6",
"cross-env": "^7.0.2",
"dumi": "^1.1.37",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.4.0",
Expand All @@ -69,6 +70,7 @@
"eslint-plugin-react-hooks": "^4.0.2",
"eslint-plugin-unicorn": "^35.0.0",
"father": "^2.13.4",
"glob": "^7.2.0",
"less": "^3.10.3",
"mockdate": "^3.0.2",
"np": "^7.1.0",
Expand Down
9 changes: 7 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"jsx": "preserve",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"],
"rc-picker": ["src/index.ts"]
}
}
}
}

0 comments on commit 13ca887

Please sign in to comment.