aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/presentational/Result.js
blob: 83c6709610c92f12708f2171beabdea0fe653713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import users from '../../users';

import IconFromUserType from './IconFromUserType';

class Result extends React.Component {
  static propTypes = {
    userId: PropTypes.string.isRequired,
    isSelected: PropTypes.bool.isRequired,
    onClick: PropTypes.func.isRequired,
  };

  render() {
    return (
      // eslint-disable-next-line
      <div
        className={classnames('search__result', {
          'search__result--selected': this.props.isSelected,
        })}
        onClick={this.props.onClick}
      >
        <div className="search__icon-wrapper">
          <IconFromUserType userType={users.byId[this.props.userId].type} />
        </div>
        <div className="search__result__text">
          {users.byId[this.props.userId].value}
          {users.byId[this.props.userId].alt &&
            <span className="search__result__text__alt">
              {` ${users.byId[this.props.userId].alt}`}
            </span>
          }
        </div>
      </div>
    );
  }
}

export default Result;