Skip to content

Commit

Permalink
docs: use dumi2.x (#38)
Browse files Browse the repository at this point in the history
* fix: fix type derivation error

* chore: father@4

* chore: remove less deps

* chore: 使用 rc 组织下的 father-plugin

* chore: 使用 rc-test 增强 jest

* chore: 移除多余配置

* chore(deps): add dumi@2

chore: 修复 dumi 配置文件错误问题

* docs: 迁移文档

* chore(pkg): update scripts

* docs: update alias

* style: format code
  • Loading branch information
Wxh16144 authored Jan 5, 2023
1 parent cc1a8e1 commit d164f7f
Show file tree
Hide file tree
Showing 30 changed files with 162 additions and 139 deletions.
17 changes: 17 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';
import path from 'path';

export default defineConfig({
alias: {
'rc-motion$': path.resolve('src'),
'rc-motion/es': path.resolve('src'),
},
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Motion',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
outputPath: '.doc',
exportStatic: {},
});
9 changes: 0 additions & 9 deletions .fatherrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ es
yarn.lock
package-lock.json
coverage/
.doc
.doc

# dumi
.dumi/tmp
.dumi/tmp-production
.dumi/tmp-test
29 changes: 0 additions & 29 deletions .npmignore

This file was deleted.

12 changes: 0 additions & 12 deletions .prettierignore

This file was deleted.

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# rc-motion

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![Dependencies][david-image]](david-url)
[![DevDependencies][david-dev-image]][david-dev-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![Dependencies][david-image]](david-url) [![DevDependencies][david-dev-image]][david-dev-url] [![bundle size][bundlephobia-image]][bundlephobia-url]

[npm-image]: http://img.shields.io/npm/v/rc-motion.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-motion
Expand Down Expand Up @@ -35,7 +29,7 @@ https://react-component.github.io/motion/

## Example

```tsx
```js
import CSSMotion from 'rc-motion';

export default ({ visible }) => (
Expand Down
8 changes: 8 additions & 0 deletions docs/demo/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: basic
nav:
title: Demo
path: /demo
---

<code src="../examples/basic.tsx"></code>
8 changes: 8 additions & 0 deletions docs/demo/deadline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: deadline
nav:
title: Demo
path: /demo
---

<code src="../examples/deadline.tsx"></code>
8 changes: 8 additions & 0 deletions docs/demo/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: list
nav:
title: Demo
path: /demo
---

<code src="../examples/list.tsx"></code>
8 changes: 8 additions & 0 deletions docs/demo/ssr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: ssr
nav:
title: Demo
path: /demo
---

<code src="../examples/ssr.tsx" iframe="500"></code>
8 changes: 8 additions & 0 deletions docs/demo/transition-inside-debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: transition-inside-debug
nav:
title: Demo
path: /demo
---

<code src="../examples/transition-inside-debug.tsx"></code>
10 changes: 5 additions & 5 deletions examples/CSSMotion.less → docs/examples/basic.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

.demo-block {
display: block;
height: 300px;
width: 300px;
background: red;
height: 300px;
overflow: hidden;
background: red;
}

.transition {
Expand All @@ -30,8 +30,8 @@
}

&.transition-leave-active {
opacity: 0;
background: green;
opacity: 0;
}
}

Expand All @@ -42,8 +42,8 @@
&.animation-appear,
&.animation-enter {
animation-name: enter;
animation-fill-mode: both;
animation-play-state: paused;
animation-fill-mode: both;
}

&.animation-appear.animation-appear-active,
Expand All @@ -54,8 +54,8 @@

&.animation-leave {
animation-name: leave;
animation-fill-mode: both;
animation-play-state: paused;
animation-fill-mode: both;

&.animation-leave-active {
animation-name: leave;
Expand Down
8 changes: 4 additions & 4 deletions examples/CSSMotion.tsx → docs/examples/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import CSSMotion from '../src';
import './CSSMotion.less';
import CSSMotion from 'rc-motion';
import './basic.less';

interface DemoState {
show: boolean;
Expand Down Expand Up @@ -30,7 +30,7 @@ const Div = React.forwardRef<HTMLDivElement, any>((props, ref) => {
return <div {...props} ref={ref} />;
});

class Demo extends React.Component<{}, DemoState> {
class App extends React.Component<{}, DemoState> {
state: DemoState = {
show: true,
forceRender: false,
Expand Down Expand Up @@ -222,4 +222,4 @@ class Demo extends React.Component<{}, DemoState> {
}
}

export default Demo;
export default App;
8 changes: 4 additions & 4 deletions examples/CSSMotionDeadline.tsx → docs/examples/deadline.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import classNames from 'classnames';
import CSSMotion from '../src';
import './CSSMotion.less';
import CSSMotion from 'rc-motion';
import './basic.less';

interface DemoState {
show: boolean;
}

class Demo extends React.Component<{}, DemoState> {
class App extends React.Component<{}, DemoState> {
state = {
show: true,
};
Expand Down Expand Up @@ -64,4 +64,4 @@ class Demo extends React.Component<{}, DemoState> {
}
}

export default Demo;
export default App;
24 changes: 12 additions & 12 deletions examples/CSSMotionList.less → docs/examples/list.less
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
@import './CSSMotion.less';
@import './basic.less';

.demo-block {
display: inline-block;
height: 100px;
width: 100px;
border-right: 5px solid #FFF;
.list-demo-block {
position: relative;
display: inline-block;
box-sizing: border-box;
width: 100px;
height: 100px;
background: red;
border-right: 5px solid #fff;

> span {
color: #FFF;
font-size: 30px;
position: absolute;
left: 50%;
top: 50%;
left: 50%;
color: #fff;
font-size: 30px;
transform: translate(-50%, -50%);
}
}


.transition {
transition: all .5s;
}
transition: all 0.5s;
}
10 changes: 5 additions & 5 deletions examples/CSSMotionList.tsx → docs/examples/list.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import classNames from 'classnames';
import { CSSMotionList } from '../src';
import './CSSMotionList.less';
import { CSSMotionList } from 'rc-motion';
import './list.less';

interface DemoState {
count: number;
checkedMap: Record<string, boolean>;
keyList: React.Key[];
}

class Demo extends React.Component<{}, DemoState> {
class App extends React.Component<{}, DemoState> {
state: DemoState = {
count: 1,
checkedMap: {},
Expand Down Expand Up @@ -104,7 +104,7 @@ class Demo extends React.Component<{}, DemoState> {
{({ key, background, className, style }) => {
return (
<div
className={classNames('demo-block', className)}
className={classNames('list-demo-block', className)}
style={{
...style,
background,
Expand All @@ -122,6 +122,6 @@ class Demo extends React.Component<{}, DemoState> {

export default () => (
<React.StrictMode>
<Demo />
<App />
</React.StrictMode>
);
10 changes: 5 additions & 5 deletions examples/SSR.tsx → docs/examples/ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';
import { hydrate } from 'react-dom';
import ReactDOMServer from 'react-dom/server';
import classNames from 'classnames';
import { genCSSMotion } from '../src/CSSMotion';
import CSSMotion from '../src';
import './CSSMotion.less';
import { genCSSMotion } from 'rc-motion/es/CSSMotion';
import CSSMotion from 'rc-motion';
import './basic.less';

const ServerCSSMotion = genCSSMotion(false);

Expand Down Expand Up @@ -35,7 +35,7 @@ const MotionAppear = ({ supportMotion }: MotionAppearProps) => {
);
};

const Demo = () => {
const App = () => {
const ssr = ReactDOMServer.renderToString(
<MotionAppear supportMotion={false} />,
);
Expand All @@ -59,4 +59,4 @@ const Demo = () => {
);
};

export default Demo;
export default App;
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

.inner-block {
position: relative;
left: 50px;
top: 50px;
left: 50px;
width: 100px;
height: 100px;
transition: background-color 1s linear;
background-color: yellowgreen;
transition: background-color 1s linear;
}

.inner-block:hover {
background-color: blueviolet;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import CSSMotion from '../src';
import './TransitionInsideDebug.less';
import CSSMotion from 'rc-motion';
import './transition-inside-debug.less';

export default function TransitionInsideDebug() {
const [visible, setVisible] = React.useState(true);
Expand Down
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
hero:
title: rc-motion
description: React lifecycle controlled motion library
---

<embed src="../README.md"></embed>
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
setupFiles: ['<rootDir>/tests/setup.js'],
setupFilesAfterEnv: ['<rootDir>/tests/setupAfterEnv.js']
setupFilesAfterEnv: ['<rootDir>/tests/setupFilesAfterEnv.ts'],
};
Loading

1 comment on commit d164f7f

@vercel
Copy link

@vercel vercel bot commented on d164f7f Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.