Skip to content

Commit 672b183

Browse files
author
emregudur
committed
messageBox componentine message Delete iconu eklendi, tasarımı düzenlendi
1 parent 6b73d96 commit 672b183

4 files changed

Lines changed: 64 additions & 1 deletion

File tree

example/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export class App extends Component {
110110
position: (this.token() >= 1 ? 'right' : 'left'),
111111
forwarded: true,
112112
replyButton: true,
113+
removeButton: true,
113114
reply: this.token() >= 1 ? ({
114115
photoURL: this.token() >= 1 ? `data:image/png;base64,${this.photo(150)}` : null,
115116
title: loremIpsum({ count: 2, units: 'words' }),
@@ -178,6 +179,9 @@ export class App extends Component {
178179
onReplyMessageClick: () => {
179180
console.log('onReplyMessageClick');
180181
},
182+
onRemoveMessageClick: () => {
183+
console.log('onReplyMessageClick');
184+
},
181185
avatar: `data:image/png;base64,${this.photo()}`,
182186
};
183187
case 'chat':

src/MessageBox/MessageBox.css

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
flex-direction: column;
33
display: block;
44
overflow-x: hidden;
5-
min-width: 200px;
5+
min-width: 300px;
66
}
77

88
.rce-mbox-forward {
@@ -62,6 +62,49 @@
6262
visibility: visible;
6363
}
6464

65+
.rce-mbox-remove {
66+
width: 30px;
67+
height: 30px;
68+
border-radius: 20px;
69+
background: #fff;
70+
position: absolute;
71+
/*display: none;*/
72+
flex-direction: row;
73+
align-self: center;
74+
align-items: center;
75+
justify-content: center;
76+
box-shadow: 0 0 5px 0 rgba(164, 164, 164, 1);
77+
cursor: pointer;
78+
transition: all 0.3s ease;
79+
top: 0;
80+
bottom: 0;
81+
margin: auto;
82+
}
83+
84+
.rce-mbox-remove-left {
85+
display: flex;
86+
opacity: 0;
87+
visibility: hidden;
88+
left: -120px;
89+
}
90+
91+
.rce-mbox-remove-right {
92+
display: flex;
93+
opacity: 0;
94+
visibility: hidden;
95+
right: -120px;
96+
}
97+
98+
.rce-container-mbox:hover .rce-mbox-remove-left {
99+
opacity: 1;
100+
visibility: visible;
101+
}
102+
103+
.rce-container-mbox:hover .rce-mbox-remove-right {
104+
opacity: 1;
105+
visibility: visible;
106+
}
107+
65108
.rce-container-mbox:hover .rce-mbox-reply-btn-left {
66109
opacity: 1;
67110
visibility: visible;

src/MessageBox/MessageBox.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import IoDoneAll from 'react-icons/lib/io/android-done-all';
1919
import MdIosTime from 'react-icons/lib/md/access-time';
2020
import MdCheck from 'react-icons/lib/md/check';
2121
import MdMessage from 'react-icons/lib/md/message';
22+
import MdRemove from 'react-icons/lib/md/delete';
2223

2324
import {
2425
format,
@@ -103,6 +104,19 @@ export class MessageBox extends React.PureComponent {
103104
</div>
104105
}
105106

107+
{
108+
this.props.removeButton === true &&
109+
<div
110+
className={classNames(
111+
'rce-mbox-remove',
112+
{ 'rce-mbox-remove-right': this.props.position === 'left' },
113+
{ 'rce-mbox-remove-left': this.props.position === 'right' }
114+
)}
115+
onClick={this.props.onRemoveMessageClick}>
116+
<MdRemove />
117+
</div>
118+
}
119+
106120
{
107121
(this.props.title || this.props.avatar) &&
108122
<div
@@ -314,6 +328,7 @@ MessageBox.defaultProps = {
314328
onTitleClick: null,
315329
onForwardClick: null,
316330
onReplyClick: null,
331+
onRemoveMessageClick: null,
317332
onReplyMessageClick: null,
318333
date: new Date(),
319334
data: {},

src/MessageList/MessageList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export class MessageList extends Component {
170170
onForwardClick={this.props.onForwardClick && ((e) => this.onForwardClick(x, i, e))}
171171
onReplyClick={this.props.onReplyClick && ((e) => this.onReplyClick(x, i, e))}
172172
onReplyMessageClick={this.props.onReplyMessageClick && ((e) => this.onReplyMessageClick(x, i, e))}
173+
onRemoveMessageClick={this.props.onRemoveMessageClick && ((e) => this.onRemoveMessageClick(x, i, e))}
173174
onClick={this.props.onClick && ((e) => this.onClick(x, i, e))}
174175
onContextMenu={this.props.onContextMenu && ((e) => this.onContextMenu(x, i, e))}
175176
onMeetingMoreSelect={this.props.onMeetingMoreSelect && ((e) => this.onMeetingMoreSelect(x, i, e))}

0 commit comments

Comments
 (0)