Switch to redux and webpack
This commit is contained in:
parent
b247287075
commit
e389454535
97 changed files with 2722 additions and 2656 deletions
53
client/src/js/components/UserList.js
Normal file
53
client/src/js/components/UserList.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
import React, { Component } from 'react';
|
||||
import Infinite from 'react-infinite';
|
||||
import pure from 'pure-render-decorator';
|
||||
import UserListItem from './UserListItem';
|
||||
|
||||
@pure
|
||||
export default class UserList extends Component {
|
||||
state = {
|
||||
height: window.innerHeight - 100
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
}
|
||||
|
||||
handleResize = () => {
|
||||
this.setState({ height: window.innerHeight - 100 });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { tab, openPrivateChat, select } = this.props;
|
||||
const users = [];
|
||||
const style = {};
|
||||
|
||||
if (!tab.channel) {
|
||||
style.display = 'none';
|
||||
} else {
|
||||
this.props.users.forEach(user => {
|
||||
users.push(
|
||||
<UserListItem
|
||||
key={user.nick}
|
||||
user={user}
|
||||
tab={tab}
|
||||
openPrivateChat={openPrivateChat}
|
||||
select={select}
|
||||
/>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="userlist" style={style}>
|
||||
<Infinite containerHeight={this.state.height} elementHeight={24}>
|
||||
{users}
|
||||
</Infinite>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue