Skip to content

Commit 83889fe

Browse files
Merge pull request #77 from Detaysoft/error-file-theme
File/Photo Message error feature added.
2 parents 346912b + 6ef12c0 commit 83889fe

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-chat-elements",
3-
"version": "10.0.5",
3+
"version": "10.1.0",
44
"description": "Reactjs chat components",
55
"author": "Avare Kodcu <abdurrahmaneker58@gmail.com>",
66
"main": "dist/main.js",

src/FileMessage/FileMessage.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import './FileMessage.css';
33

44
import FaCloudDownload from 'react-icons/lib/fa/cloud-download';
5+
import FaError from 'react-icons/lib/fa/exclamation-triangle';
56
import FaFile from 'react-icons/lib/fa/file';
67

78
const ProgressBar = require('react-progress-bar.js');
@@ -37,6 +38,8 @@ export class FileMessage extends Component {
3738
}
3839
};
3940

41+
const error = this.props.data.status && this.props.data.status.error === true;
42+
4043
return (
4144
<div className='rce-mbox-file'>
4245
<button onClick={this.onClick.bind(this)}>
@@ -52,13 +55,20 @@ export class FileMessage extends Component {
5255
</div>
5356
<div className="rce-mbox-file--buttons">
5457
{
58+
error &&
59+
<FaError
60+
color='#ff3d3d'/>
61+
}
62+
{
63+
!error &&
5564
this.props.data.status &&
5665
!this.props.data.status.download &&
5766
!this.props.data.status.click &&
5867
<FaCloudDownload
5968
color='#aaa'/>
6069
}
6170
{
71+
!error &&
6272
this.props.data.status &&
6373
typeof this.props.data.status.loading === 'number' &&
6474
this.props.data.status.loading !== 0 &&

src/PhotoMessage/PhotoMessage.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { Component } from 'react';
33
import './PhotoMessage.css';
44

55
import FaCloudDownload from 'react-icons/lib/fa/cloud-download';
6+
import FaError from 'react-icons/lib/fa/exclamation-triangle';
67

78
const ProgressBar = require('react-progress-bar.js');
89
const Circle = ProgressBar.Circle;
@@ -26,6 +27,8 @@ export class PhotoMessage extends Component {
2627
}
2728
};
2829

30+
const error = this.props.data.status && this.props.data.status.error === true;
31+
2932
return (
3033
<div className="rce-mbox-photo">
3134
<div
@@ -39,7 +42,18 @@ export class PhotoMessage extends Component {
3942
alt={this.props.data.alt}
4043
onClick={this.props.onOpen}
4144
onLoad={this.props.onLoad}/>
45+
46+
{
47+
error &&
48+
<div className="rce-mbox-photo--img__block">
49+
<button
50+
className="rce-mbox-photo--img__block-item rce-mbox-photo--download">
51+
<FaError/>
52+
</button>
53+
</div>
54+
}
4255
{
56+
!error &
4357
this.props.data.status &&
4458
!this.props.data.status.download &&
4559
<div className="rce-mbox-photo--img__block">

0 commit comments

Comments
 (0)