@imposium-hub/components 1.41.4 → 1.41.6

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.
@@ -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 IVideoPreviewProps {
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
- class ImagePreview extends React.PureComponent<IVideoPreviewProps> {
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='asset-preview-background'
61
+ className={`asset-preview-background transparent ${!loaded ? 'hidden' : ''}`}
51
62
  style={style}
52
63
  />
53
64
  </Portal>
@@ -139,6 +139,7 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
139
139
  if (status === 400) {
140
140
  handleError(copy.publish.missingColumns);
141
141
  alert(copy.publish.csvMissingColumns + data.error);
142
+ this.hiddenFileInputRef.current.value = '';
142
143
  }
143
144
  this.setState({uploadComplete: false, uploading: false});
144
145
  throw e;