improve badges and room tile layout

pull/1/head
Matthew Hodgson 2015-07-16 22:39:38 +01:00
parent 28dcfb2f12
commit a2ca5f2847
2 changed files with 22 additions and 4 deletions

View File

@ -29,8 +29,8 @@ limitations under the License.
padding-top: 3px;
padding-bottom: 3px;
vertical-align: middle;
width: 32px;
height: 32px;
width: 40px;
height: 40px;
}
.mx_RoomTile_avatar img {
@ -38,6 +38,12 @@ limitations under the License.
background-color: #dbdbdb;
}
.mx_RoomTile_nameBadge {
display: table;
width: 100%;
height: 50px;
}
.mx_RoomTile_name {
display: table-cell;
vertical-align: middle;
@ -45,8 +51,13 @@ limitations under the License.
text-overflow: ellipsis;
}
.mx_RoomTile_badgeCell {
display: table-cell;
vertical-align: middle;
width: 26px;
}
.mx_RoomTile_badge {
float: right;
background-color: #80cef4;
color: #fff;
border-radius: 26px;

View File

@ -43,10 +43,17 @@ module.exports = React.createClass({
else if (this.props.unread) {
badge = <div className="mx_RoomTile_badge">1</div>;
}
var nameCell;
if (badge) {
nameCell = <div className="mx_RoomTile_nameBadge"><div className="mx_RoomTile_name">{name}</div><div className="mx_RoomTile_badgeCell">{badge}</div></div>;
}
else {
nameCell = <div className="mx_RoomTile_name">{name}</div>;
}
return (
<div className={classes} onClick={this.onClick}>
<div className="mx_RoomTile_avatar"><img src={ MatrixClientPeg.get().getAvatarUrlForRoom(this.props.room, 40, 40, "crop") } width="40" height="40"/></div>
<div className="mx_RoomTile_name">{name}{ badge }</div>
{ nameCell }
</div>
);
}