File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ import { ChatItem } from 'react-chat-elements'
9191| onClick | none | function | ChatItem on click |
9292| onContextMenu | none | function | ChatItem on context menu |
9393| statusColor | none | color | ChatItem status color |
94+ | statusColorType | badge | string | ChatItem status color type (encircle, badge) |
9495| statusText | none | color | ChatItem status text |
9596| lazyLoadingImage | none | image path | lazy loading image |
9697
@@ -522,4 +523,4 @@ import { SpotifyMessage } from 'react-chat-elements'
522523| view | list | string | spotify view type (list or coverart) |
523524| data | {} | object | message data |
524525| width | 300 | int | spotify embed width |
525- | height | 380 | int | spotify embed height |
526+ | height | 380 | int | spotify embed height |
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ export class App extends Component {
127127 avatar : `data:image/png;base64,${ this . photo ( ) } ` ,
128128 avatarFlexible : true ,
129129 statusColor : 'lightgreen' ,
130+ statusColorType : parseInt ( Math . random ( ) * 100 % 2 ) === 1 ? 'encircle' : undefined ,
130131 alt : loremIpsum ( { count : 2 , units : 'words' } ) ,
131132 title : loremIpsum ( { count : 2 , units : 'words' } ) ,
132133 date : new Date ( ) ,
Original file line number Diff line number Diff line change 33 display : flex;
44 justify-content : center;
55 align-items : center;
6- overflow : hidden;
76}
87
98.rce-avatar-container .rce-avatar {
7170.rce-avatar-lazy {
7271 animation : avatarLazy normal 2s infinite ease-in-out;
7372}
73+
74+ .rce-avatar-container .rce-citem-avatar-encircle-status {
75+ box-sizing : border-box;
76+ position : relative;
77+ }
Original file line number Diff line number Diff line change 55 min-width : 240px ;
66}
77
8+ .rce-container-citem .rce-citem-status-encircle {
9+ position : relative;
10+ }
11+
812.rce-citem {
913 position : relative;
1014 background : white;
4347 background : # ccc ;
4448}
4549
50+ .rce-citem-avatar .rce-citem-status-encircle .rce-citem-status {
51+ left : 0 ;
52+ right : 0 ;
53+ top : 0 ;
54+ bottom : 0 ;
55+ width : 100% ;
56+ height : 100% ;
57+ background : transparent;
58+ margin : auto;
59+ border-radius : 100% ;
60+ }
61+
4662.rce-citem-avatar img {
4763 width : 50px ;
4864 height : 50px ;
Original file line number Diff line number Diff line change @@ -12,20 +12,34 @@ import classNames from 'classnames';
1212export class ChatItem extends Component {
1313
1414 render ( ) {
15+ const statusColorType = this . props . statusColorType ;
16+
1517 return (
1618 < div
1719 className = { classNames ( 'rce-container-citem' , this . props . className ) }
1820 onClick = { this . props . onClick }
1921 onContextMenu = { this . props . onContextMenu } >
2022 < div className = "rce-citem" >
21- < div className = "rce-citem-avatar" >
23+ < div className = { classNames (
24+ "rce-citem-avatar" ,
25+ {
26+ 'rce-citem-status-encircle' : statusColorType === 'encircle' ,
27+ }
28+ ) } >
2229 < Avatar
2330 src = { this . props . avatar }
2431 alt = { this . props . alt }
32+ className = { statusColorType === 'encircle' ? 'rce-citem-avatar-encircle-status' : '' }
2533 size = "large"
2634 sideElement = {
2735 this . props . statusColor &&
28- < span className = 'rce-citem-status' style = { { backgroundColor : this . props . statusColor } } >
36+ < span
37+ className = 'rce-citem-status'
38+ style = { statusColorType === 'encircle' ? {
39+ boxShadow : `inset 0 0 0 2px ${ this . props . statusColor } , inset 0 0 0 5px #FFFFFF`
40+ } : {
41+ backgroundColor : this . props . statusColor ,
42+ } } >
2943 { this . props . statusText }
3044 </ span >
3145 }
@@ -80,6 +94,7 @@ ChatItem.defaultProps = {
8094 date : new Date ( ) ,
8195 unread : 0 ,
8296 statusColor : null ,
97+ statusColorType : 'badge' ,
8398 statusText : null ,
8499 dateString : null ,
85100 lazyLoadingImage : undefined ,
You can’t perform that action at this time.
0 commit comments