{"size": 714, "ext": "js", "max_stars_repo_path": "catbook-react/client/src/components/modules/SingleUser.js", "max_stars_repo_name": "sunmiao0301/MIT-6.148-Web-Lab", "max_stars_repo_stars_event_min_datetime": "2022-03-22T04:37:30.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T14:20:03.000Z", "max_issues_repo_path": "catbook-react/client/src/components/modules/SingleUser.js", "max_issues_repo_name": "sunmiao0301/MIT-6.148-Web-Lab", "max_issues_repo_issues_event_min_datetime": "2022-03-30T10:33:30.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T10:55:56.000Z", "max_forks_repo_path": "catbook-react/client/src/components/modules/SingleUser.js", "max_forks_repo_name": "sunmiao0301/MIT-6.148-Web-Lab", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 20.4, "max_line_length": 91, "alphanum_fraction": 0.5896358543}
import React, { Component } from "react";

import "./SingleUser.css";

/**
 * Component to render an online user
 *
 * Proptypes
 * @param {(UserObject) => ()} setActiveUser function that takes in user, sets it to active
 * @param {UserObject} user
 * @param {boolean} active
 */
class SingleUser extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div
        className={`SingleUser-container u-pointer ${
          this.props.active ? "SingleUser-container--active" : ""
        }`}
        onClick={() => {
          this.props.setActiveUser(this.props.user);
        }}
      >
        {this.props.user.name}
      </div>
    );
  }
}

export default SingleUser;
