diff --git a/website/src/Users/UserList.js b/website/src/Users/UserList.js index bad2131..53f3ad1 100644 --- a/website/src/Users/UserList.js +++ b/website/src/Users/UserList.js @@ -27,26 +27,23 @@ export class UserList extends React.Component { render() { const { selectedUser, selectionModified } = this.props + const { users } = this.state return ( - - { - this.state.users - ? this.state.users.map((user, index) => - ( (this.props.onUserListClick(e, index))} + { + return ( + (this.props.onUserListClick(e, index))} active={user === this.props.selectedUser}> { user._id ? user.firstName + ' ' + user.lastName : '[New User]' } { user === selectedUser && selectionModified ? : null } - ) + ) - : null - } - + }} /> diff --git a/website/src/ui/List.js b/website/src/ui/List.js index 5b07664..227b5d4 100644 --- a/website/src/ui/List.js +++ b/website/src/ui/List.js @@ -6,13 +6,12 @@ import { sizeInfo, colorInfo, fontInfo } from './style' class List extends Component { static propTypes = { - children: PropTypes.node, - // data: PropTypes.array, - // render: PropTypes.func, + data: PropTypes.array, + render: PropTypes.func.isRequired, } render() { - const { children } = this.props + const { data, render } = this.props return ( - {children} + {data ? data.map(render) : null} ) }