Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.

Commit f4a691d

Browse files
committed
use .tsx for examples
1 parent 538fcd5 commit f4a691d

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

examples/follow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import Align from '../src';
44
const Demo = () => {
55
const [width, setWidth] = React.useState(100);
66
const [height, setHeight] = React.useState(100);
7-
const [left, setLeft] = React.useState(100);
8-
const [top, setTop] = React.useState(100);
7+
const [left, setLeft] = React.useState('100%');
8+
const [top, setTop] = React.useState('100%');
99
const [visible, setVisible] = React.useState(true);
1010
const [svg, setSvg] = React.useState(false);
1111

examples/point.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React, { Component } from 'react';
1+
import React, { Component, Ref } from 'react';
22
import Align from '../src';
3+
import {RefAlign} from '../src/Align';
34

45
const align = {
56
points: ['cc', 'cc'],
@@ -13,6 +14,7 @@ class Demo extends Component {
1314
onClick = ({ pageX, pageY }) => {
1415
this.setState({ point: { pageX, pageY } });
1516
};
17+
alignRef: Ref<RefAlign>;
1618

1719
render() {
1820
return (

examples/simple.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
import { AlignType } from '../src/interface';
12
import React, { Component } from 'react';
23
import Align from '../src';
4+
import {RefAlign} from '../src/Align';
35

46
const allPoints = ['tl', 'tc', 'tr', 'cl', 'cc', 'cr', 'bl', 'bc', 'br'];
57

6-
class Test extends Component {
8+
class Test extends Component<{}, {
9+
monitor: boolean;
10+
random: boolean;
11+
disabled: boolean;
12+
randomWidth: number;
13+
align: AlignType;
14+
sourceWidth: number;
15+
}> {
716
state = {
817
monitor: true,
918
random: false,
@@ -14,6 +23,9 @@ class Test extends Component {
1423
},
1524
sourceWidth: 50,
1625
};
26+
id: ReturnType<typeof setInterval>;
27+
$container: HTMLElement | null = null;
28+
$align: RefAlign;
1729

1830
componentDidMount() {
1931
this.id = setInterval(() => {

0 commit comments

Comments
 (0)