Skip to content

Commit 8f8df90

Browse files
committed
chore: clean up
1 parent 53f894a commit 8f8df90

File tree

17 files changed

+14
-717
lines changed

17 files changed

+14
-717
lines changed

.dumirc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from 'dumi';
22

33
export default defineConfig({
44
themeConfig: {
5-
name: 'Align',
5+
name: 'Context',
66
},
77
mfsu: false,
88
});

HISTORY.md

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

docs/demo/follow.md

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

docs/demo/point.md

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

docs/examples/follow.tsx

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

docs/examples/point.tsx

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

docs/examples/simple.tsx

Lines changed: 1 addition & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1 @@
1-
import Align, { type RefAlign } from 'rc-align';
2-
import React, { Component } from 'react';
3-
4-
const allPoints = ['tl', 'tc', 'tr', 'cl', 'cc', 'cr', 'bl', 'bc', 'br'];
5-
6-
interface TestState {
7-
monitor: boolean;
8-
random: boolean;
9-
disabled: boolean;
10-
randomWidth: number;
11-
align: any;
12-
sourceWidth: number;
13-
}
14-
15-
class Test extends Component<{}, TestState> {
16-
state = {
17-
monitor: true,
18-
random: false,
19-
disabled: false,
20-
randomWidth: 100,
21-
align: {
22-
points: ['cc', 'cc'],
23-
},
24-
sourceWidth: 50,
25-
};
26-
27-
id: NodeJS.Timer;
28-
$container: HTMLElement;
29-
$align: RefAlign;
30-
31-
componentDidMount() {
32-
this.id = setInterval(() => {
33-
const { random } = this.state;
34-
if (random) {
35-
this.setState({
36-
randomWidth: 60 + 40 * Math.random(),
37-
});
38-
}
39-
}, 1000);
40-
}
41-
42-
componentWillUnmount() {
43-
clearInterval(this.id);
44-
}
45-
46-
getTarget = () => {
47-
if (!this.$container) {
48-
// parent ref not attached
49-
this.$container = document.getElementById('container');
50-
}
51-
return this.$container;
52-
};
53-
54-
containerRef = ele => {
55-
this.$container = ele;
56-
};
57-
58-
alignRef = node => {
59-
this.$align = node;
60-
};
61-
62-
toggleMonitor = () => {
63-
this.setState(({ monitor }) => ({
64-
monitor: !monitor,
65-
}));
66-
};
67-
68-
toggleRandom = () => {
69-
this.setState(({ random }) => ({
70-
random: !random,
71-
}));
72-
};
73-
74-
toggleDisabled = () => {
75-
this.setState(({ disabled }) => ({
76-
disabled: !disabled,
77-
}));
78-
};
79-
80-
randomAlign = () => {
81-
const randomPoints = [];
82-
randomPoints.push(allPoints[Math.floor(Math.random() * 100) % allPoints.length]);
83-
randomPoints.push(allPoints[Math.floor(Math.random() * 100) % allPoints.length]);
84-
this.setState({
85-
align: {
86-
points: randomPoints,
87-
},
88-
});
89-
};
90-
91-
forceAlign = () => {
92-
this.$align.forceAlign();
93-
};
94-
95-
toggleSourceSize = () => {
96-
this.setState({
97-
// eslint-disable-next-line react/no-access-state-in-setstate
98-
sourceWidth: this.state.sourceWidth + 10,
99-
});
100-
};
101-
102-
render() {
103-
const { random, randomWidth } = this.state;
104-
105-
return (
106-
<div
107-
style={{
108-
margin: 50,
109-
}}
110-
>
111-
<p>
112-
<button type="button" onClick={this.forceAlign}>
113-
Force align
114-
</button>
115-
&nbsp;&nbsp;&nbsp;
116-
<button type="button" onClick={this.toggleSourceSize}>
117-
Resize Source
118-
</button>
119-
&nbsp;&nbsp;&nbsp;
120-
<button type="button" onClick={this.randomAlign}>
121-
Random Align
122-
</button>
123-
&nbsp;&nbsp;&nbsp;
124-
<label>
125-
<input type="checkbox" checked={this.state.monitor} onChange={this.toggleMonitor} />
126-
&nbsp; Monitor window resize
127-
</label>
128-
<label>
129-
<input type="checkbox" checked={this.state.random} onChange={this.toggleRandom} />
130-
&nbsp; Random Size
131-
</label>
132-
<label>
133-
<input type="checkbox" checked={this.state.disabled} onChange={this.toggleDisabled} />
134-
&nbsp; Disabled
135-
</label>
136-
</p>
137-
<div
138-
ref={this.containerRef}
139-
id="container"
140-
style={{
141-
width: '80%',
142-
// maxWidth: 1000,
143-
height: 500,
144-
border: '1px solid red',
145-
...(random
146-
? {
147-
width: `${randomWidth}%`,
148-
}
149-
: null),
150-
}}
151-
>
152-
<Align
153-
ref={this.alignRef}
154-
target={this.getTarget}
155-
monitorWindowResize={this.state.monitor}
156-
align={this.state.align}
157-
disabled={this.state.disabled}
158-
>
159-
<div
160-
style={{
161-
position: 'absolute',
162-
width: this.state.sourceWidth,
163-
height: 50,
164-
background: 'yellow',
165-
}}
166-
>
167-
<input defaultValue="source" style={{ width: '100%' }} />
168-
</div>
169-
</Align>
170-
</div>
171-
</div>
172-
);
173-
}
174-
}
175-
176-
export default Test;
1+
export default () => 'Hello World';

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
hero:
3-
title: rc-align
4-
description: align ui component for react
3+
title: @rc-component/context
4+
description: Context Selector for perf enhancement
55
---
66

77
<embed src="../README.md"></embed>

index.js

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

now.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 2,
3-
"name": "rc-align",
3+
"name": "rc-context",
44
"builds": [
55
{
66
"src": "package.json",

0 commit comments

Comments
 (0)