Last active
June 4, 2018 16:16
-
-
Save bookercodes/5c82d4038bc9b1fb4be28ee27e411365 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./src/OnlineList.js | |
import React, { Component } from 'react' | |
import { | |
ListView, | |
ListViewSection, | |
ListViewSectionHeader, | |
ListViewRow, | |
Text | |
} from 'react-desktop/macOs' | |
class OnlineList extends Component { | |
render() { | |
return ( | |
<ListView className="online-list"> | |
<ListViewSection> | |
{this.props.users && | |
this.props.users.map((user, index) => { | |
if (user.id === this.props.currentUser.id) { | |
return this.renderItem( | |
`${user.name} (You)`, | |
user.id, | |
user.presence.state | |
) | |
} | |
return this.renderItem(user.name, user.id, user.presence.state) | |
})} | |
</ListViewSection> | |
</ListView> | |
) | |
} | |
renderItem(name, id, status) { | |
const itemStyle = {} | |
return ( | |
<ListViewRow key={id}> | |
<div | |
className="online-list-item" | |
style={{ | |
background: status === 'online' ? '#6BD761' : 'gray' | |
}} | |
/> | |
<Text color="#414141" size="13"> | |
{name}{' '} | |
</Text>{' '} | |
</ListViewRow> | |
) | |
} | |
} | |
export default OnlineList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment