Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/follow.js → examples/follow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Align from '../src';
const Demo = () => {
const [width, setWidth] = React.useState(100);
const [height, setHeight] = React.useState(100);
const [left, setLeft] = React.useState(100);
const [top, setTop] = React.useState(100);
const [left, setLeft] = React.useState('100%');
const [top, setTop] = React.useState('100%');
const [visible, setVisible] = React.useState(true);
const [svg, setSvg] = React.useState(false);

Expand Down
4 changes: 3 additions & 1 deletion examples/point.js → examples/point.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import React, { Component, Ref } from 'react';
import Align from '../src';
import {RefAlign} from '../src/Align';

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

render() {
return (
Expand Down
14 changes: 13 additions & 1 deletion examples/simple.js → examples/simple.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { AlignType } from '../src/interface';
import React, { Component } from 'react';
import Align from '../src';
import {RefAlign} from '../src/Align';

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

class Test extends Component {
class Test extends Component<{}, {
monitor: boolean;
random: boolean;
disabled: boolean;
randomWidth: number;
align: AlignType;
sourceWidth: number;
}> {
state = {
monitor: true,
random: false,
Expand All @@ -14,6 +23,9 @@ class Test extends Component {
},
sourceWidth: 50,
};
id: ReturnType<typeof setInterval>;
$container: HTMLElement | null = null;
$align: RefAlign;

componentDidMount() {
this.id = setInterval(() => {
Expand Down