Przeglądaj źródła

Fix: seen user list shows only when the number of users are between 1 and 10

Sotaro KARASAWA 9 lat temu
rodzic
commit
4669ccaf1c
1 zmienionych plików z 13 dodań i 0 usunięć
  1. 13 0
      resource/js/components/SeenUserList/UserList.js

+ 13 - 0
resource/js/components/SeenUserList/UserList.js

@@ -3,7 +3,20 @@ import UserPicture from '../User/UserPicture';
 
 export default class UserList extends React.Component {
 
+  isSeenUserListShown() {
+    const userCount = this.props.users.length;
+    if (0 < userCount && userCount <= 10) {
+      return true;
+    }
+
+    return false;
+  }
+
   render() {
+    if (!this.isSeenUserListShown()) {
+      return null;
+    }
+
     const users = this.props.users.map((user) => {
       return (
         <a key={user._id} data-user-id={user._id} href={'/user/' + user.username} title={user.name}>