blob: 2b66b83fefb74e0a5e3933b71043018484f9a8be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import { observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { RectangleTemplate } from './FaceRectangles';
@observer
export default class FaceRectangle extends React.Component<{ rectangle: RectangleTemplate }> {
@observable private opacity = 0;
componentDidMount() {
setTimeout(
() =>
runInAction(() => {
this.opacity = 1;
}),
500
);
}
render() {
const { rectangle } = this.props;
return (
<div
style={{
...rectangle.style,
opacity: this.opacity,
transition: '1s ease opacity',
position: 'absolute',
borderRadius: 5,
}}
/>
);
}
}
|