{"size": 1220, "ext": "js", "max_stars_repo_path": "app/components/User/User.js", "max_stars_repo_name": "andreaswachowski/reactjs-duckr", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/components/User/User.js", "max_issues_repo_name": "andreaswachowski/reactjs-duckr", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/components/User/User.js", "max_forks_repo_name": "andreaswachowski/reactjs-duckr", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.1052631579, "max_line_length": 92, "alphanum_fraction": 0.5426229508}
import React, {PropTypes} from 'react';
import {userContainer, header} from './styles.css';
import {errorMsg} from 'sharedStyles/styles.css';
import {DuckContainer} from 'containers';

User.propTypes = {
  noUser: PropTypes.bool.isRequired,
  name: PropTypes.string.isRequired,
  isFetching: PropTypes.bool.isRequired,
  error: PropTypes.string.isRequired,
  duckIds: PropTypes.array.isRequired
};

export default function User (props) {
  return (
    props.noUser === true
      ? <p className={header}>{'This user does not exist'}</p>
      : <div>
          {props.isFetching === true
          ? <p className={'header'}>{'Loading'}</p>
          : <div>
              <div className={userContainer}>
                <div>{props.name}</div>
              </div>
              {props.duckIds.map((id) => (
              <DuckContainer duckId={id} key={id} />
              ))}
              {props.duckIds.length === 0
                ? <p className={header}>
                    {`It looks like ${props.name.split(' ')[0]} hasn't made any ducks yet.`}
                  </p>
                : null}
            </div>}
          {props.error ? <p className={errorMsg}>{props.error}</p> : null}
        </div>
  );
}
