@imposium-hub/components 1.41.4 → 1.41.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/players/ImagePreview.tsx +14 -3
- package/dist/components.js +1 -1
- package/dist/components.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/styles.less +17 -2
- package/dist/styles.less.map +1 -1
- package/less/components/assets.less +8 -1
- package/less/components/player.less +2 -2
- package/less/mixins.less +7 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import Portal from '../portal/Portal';
|
|
|
3
3
|
import {ICON_TIMES} from '../../constants/icons';
|
|
4
4
|
import Button from '../button/Button';
|
|
5
5
|
import {assets as copy} from '../../constants/copy';
|
|
6
|
-
interface
|
|
6
|
+
interface IImagePreviewProps {
|
|
7
7
|
showMedia : boolean;
|
|
8
8
|
url : string;
|
|
9
9
|
playbackSettings? : any;
|
|
@@ -11,7 +11,11 @@ interface IVideoPreviewProps {
|
|
|
11
11
|
onRequestClose?(e) : void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
interface IImagePreviewState {
|
|
15
|
+
loaded : boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class ImagePreview extends React.PureComponent<IImagePreviewProps, IImagePreviewState> {
|
|
15
19
|
private imageNode : any = null;
|
|
16
20
|
private evtHandlers : any;
|
|
17
21
|
constructor(props) {
|
|
@@ -20,6 +24,9 @@ class ImagePreview extends React.PureComponent<IVideoPreviewProps> {
|
|
|
20
24
|
this.evtHandlers = {
|
|
21
25
|
onClose: (e) => this.onClose(e)
|
|
22
26
|
};
|
|
27
|
+
this.state = {
|
|
28
|
+
loaded: false
|
|
29
|
+
};
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
private onClose(e) {
|
|
@@ -28,8 +35,11 @@ class ImagePreview extends React.PureComponent<IVideoPreviewProps> {
|
|
|
28
35
|
|
|
29
36
|
onRequestClose(e);
|
|
30
37
|
}
|
|
38
|
+
|
|
31
39
|
public render() {
|
|
32
40
|
const {showMedia, url, style} = this.props;
|
|
41
|
+
const {loaded} = this.state;
|
|
42
|
+
|
|
33
43
|
if (showMedia) {
|
|
34
44
|
return (
|
|
35
45
|
<Portal id='portal-root'>
|
|
@@ -45,9 +55,10 @@ class ImagePreview extends React.PureComponent<IVideoPreviewProps> {
|
|
|
45
55
|
</Button>
|
|
46
56
|
</div>
|
|
47
57
|
<img
|
|
58
|
+
onLoad = {() => this.setState({loaded: true})}
|
|
48
59
|
src={url}
|
|
49
60
|
ref={this.imageNode}
|
|
50
|
-
className=
|
|
61
|
+
className={`asset-preview-background transparent ${!loaded ? 'hidden' : ''}`}
|
|
51
62
|
style={style}
|
|
52
63
|
/>
|
|
53
64
|
</Portal>
|