@@ -11,23 +11,12 @@ import { MdVideoCall, MdVolumeOff, MdVolumeUp } from 'react-icons/md'
1111import { IChatItemProps } from '../type'
1212
1313const ChatItem : React . FC < IChatItemProps > = ( {
14- id = '' ,
15- onClick = null ,
16- avatar = '' ,
1714 avatarFlexible = false ,
18- alt = '' ,
19- title = '' ,
20- subtitle = '' ,
2115 date = new Date ( ) ,
2216 unread = 0 ,
23- statusColor = null ,
2417 statusColorType = 'badge' ,
25- statusText = null ,
26- dateString = null ,
2718 lazyLoadingImage = undefined ,
2819 onAvatarError = ( ) => void 0 ,
29- showMute = null ,
30- showVideoCall = null ,
3120 ...props
3221} ) => {
3322 const [ onHoverTool , setOnHoverTool ] = useState ( false )
@@ -46,64 +35,64 @@ const ChatItem: React.FC<IChatItemProps> = ({
4635
4736 if ( onHoverTool === true ) return
4837
49- onClick ?.( e )
38+ props . onClick ?.( e )
5039 }
5140
5241 const onDragOver = ( e : React . MouseEvent ) => {
5342 e . preventDefault ( )
54- if ( props . onDragOver instanceof Function ) props . onDragOver ( e , id )
43+ if ( props . onDragOver instanceof Function ) props . onDragOver ( e , props . id )
5544 }
5645
5746 const onDragEnter = ( e : React . MouseEvent ) => {
5847 e . preventDefault ( )
59- if ( props . onDragEnter instanceof Function ) props . onDragEnter ( e , id )
48+ if ( props . onDragEnter instanceof Function ) props . onDragEnter ( e , props . id )
6049 if ( ! onDrag ) setOnDrag ( true )
6150 }
6251
6352 const onDragLeave = ( e : React . MouseEvent ) => {
6453 e . preventDefault ( )
65- if ( props . onDragLeave instanceof Function ) props . onDragLeave ( e , id )
54+ if ( props . onDragLeave instanceof Function ) props . onDragLeave ( e , props . id )
6655 if ( onDrag ) setOnDrag ( false )
6756 }
6857
6958 const onDrop = ( e : React . MouseEvent ) => {
7059 e . preventDefault ( )
71- if ( props . onDrop instanceof Function ) props . onDrop ( e , id )
60+ if ( props . onDrop instanceof Function ) props . onDrop ( e , props . id )
7261 if ( onDrag ) setOnDrag ( false )
7362 }
7463
7564 return (
7665 < div
77- key = { id as Key }
66+ key = { props . id as Key }
7867 className = { classNames ( 'rce-container-citem' , props . className ) }
7968 onClick = { handleOnClick }
8069 onContextMenu = { props . onContextMenu }
8170 >
8271 < div className = 'rce-citem' onDragOver = { onDragOver } onDragEnter = { onDragEnter } onDragLeave = { onDragLeave } onDrop = { onDrop } >
83- { ! ! props . onDragComponent && onDrag && props . onDragComponent ( id ) }
72+ { ! ! props . onDragComponent && onDrag && props . onDragComponent ( props . id ) }
8473 { ( ( onDrag && ! props . onDragComponent ) || ! onDrag ) && [
8574 < div className = { classNames ( 'rce-citem-avatar' , { 'rce-citem-status-encircle' : statusColorType === 'encircle' } ) } >
8675 < Avatar
87- src = { avatar }
88- alt = { alt }
76+ src = { props . avatar }
77+ alt = { props . alt }
8978 className = { statusColorType === 'encircle' ? 'rce-citem-avatar-encircle-status' : '' }
9079 size = 'large'
9180 letterItem = { props . letterItem }
9281 sideElement = {
93- statusColor ? (
82+ props . statusColor ? (
9483 < span
9584 className = 'rce-citem-status'
9685 style = {
9786 statusColorType === 'encircle'
9887 ? {
99- border : `solid 2px ${ statusColor } ` ,
88+ border : `solid 2px ${ props . statusColor } ` ,
10089 }
10190 : {
102- backgroundColor : statusColor ,
91+ backgroundColor : props . statusColor ,
10392 }
10493 }
10594 >
106- { statusText }
95+ { props . statusText }
10796 </ span >
10897 ) : (
10998 < > </ >
@@ -116,27 +105,27 @@ const ChatItem: React.FC<IChatItemProps> = ({
116105 </ div > ,
117106 < div className = 'rce-citem-body' >
118107 < div className = 'rce-citem-body--top' >
119- < div className = 'rce-citem-body--top-title' > { title } </ div >
120- < div className = 'rce-citem-body--top-time' > { date && ( dateString || format ( date ) ) } </ div >
108+ < div className = 'rce-citem-body--top-title' > { props . title } </ div >
109+ < div className = 'rce-citem-body--top-time' > { date && ( props . dateString || format ( date ) ) } </ div >
121110 </ div >
122111
123112 < div className = 'rce-citem-body--bottom' >
124- < div className = 'rce-citem-body--bottom-title' > { subtitle } </ div >
113+ < div className = 'rce-citem-body--bottom-title' > { props . subtitle } </ div >
125114 < div className = 'rce-citem-body--bottom-tools' onMouseEnter = { handleOnMouseEnter } onMouseLeave = { handleOnMouseLeave } >
126- { showMute && (
115+ { props . showMute && (
127116 < div className = 'rce-citem-body--bottom-tools-item' onClick = { props . onClickMute } >
128117 { props . muted === true && < MdVolumeOff /> }
129118 { props . muted === false && < MdVolumeUp /> }
130119 </ div >
131120 ) }
132- { showVideoCall && (
121+ { props . showVideoCall && (
133122 < div className = 'rce-citem-body--bottom-tools-item' onClick = { props . onClickVideoCall } >
134123 < MdVideoCall />
135124 </ div >
136125 ) }
137126 </ div >
138127 < div className = 'rce-citem-body--bottom-tools-item-hidden-hover' >
139- { showMute && props . muted && (
128+ { props . showMute && props . muted && (
140129 < div className = 'rce-citem-body--bottom-tools-item' >
141130 < MdVolumeOff />
142131 </ div >
0 commit comments