sidebar active + unread styling

master
f0x 5 years ago
parent 7e2f2c551e
commit fd2e57b67a

@ -65,7 +65,8 @@ let RoomListItem = create({
getInitialState: function() { getInitialState: function() {
return { return {
filterName: this.props.name.toUpperCase() filterName: this.props.name.toUpperCase(),
unread: Math.random() > 0.7
} }
}, },
@ -83,8 +84,12 @@ let RoomListItem = create({
} }
let className = "roomListItem" let className = "roomListItem"
if (this.props.active) { if (this.props.active) {
className += " active"; className += " active"
} }
if (this.state.unread) {
className += " unread"
}
console.log(className)
return <div className={className} ref={this.setRef}> return <div className={className} ref={this.setRef}>
<img id="avatar" src="https://placekitten.com/100/100"/> <img id="avatar" src="https://placekitten.com/100/100"/>
<span id="name">{this.props.name}</span> <span id="name">{this.props.name}</span>

@ -6,6 +6,8 @@ $bg3: #888888;
$bg4: #ebebeb; $bg4: #ebebeb;
$bg5: #ffffff; $bg5: #ffffff;
$amber: #ff9000;
$spacing: 0.7rem; $spacing: 0.7rem;
@font-face { @font-face {
@ -83,31 +85,49 @@ body {
div { div {
cursor: pointer; cursor: pointer;
} }
div.active {
background: lighten($bg1, 5);
}
} }
.roomListItem { .roomListItem {
height: 1.5rem + 2* $spacing; height: 2rem + 2* $spacing;
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid lighten($bg1, 3); border-bottom: 1px solid lighten($bg1, 3);
&:hover {
background: $bg1;
}
&.active {
background: $bg1;
#avatar, #name {
transition: 0.2s;
}
#avatar {
border: 3px solid $amber;
}
#name {
color: $amber;
font-weight: bold;
font-family: "Roboto Mono Bold", monospace;
}
}
#avatar { #avatar {
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: calc(100% - 6px);
object-fit: cover; object-fit: cover;
padding: 0.2rem; border: 3px solid lighten($bg0, 10);
border-radius: 0.4rem;
margin: 3px;
} }
#name { #name {
font-size: 1rem; font-size: 1rem;
font-weight: bold;
font-family: "Roboto Mono Bold", monospace;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
@ -119,6 +139,9 @@ body {
.info { .info {
background: $bg1; background: $bg1;
padding: $spacing; padding: $spacing;
color: $amber;
font-weight: bold;
font-family: "Roboto Mono Bold", monospace;
} }
.chat { .chat {

Loading…
Cancel
Save