]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/users/Box.js
139e6f65573081dda97849ead6a0681b5ae292b4
[alttp.git] / resources / js / components / users / Box.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { withTranslation } from 'react-i18next';
4
5 import { getAvatarUrl } from '../../helpers/User';
6 import i18n from '../../i18n';
7
8 const Box = ({ user }) => user ?
9         <span className="user-box">
10                 <img alt="" src={getAvatarUrl(user)} />
11                 <span>{user.username}</span>
12                 <span className="text-muted">
13                         {'#'}
14                         {user.discriminator}
15                 </span>
16         </span>
17 :
18         <span>{i18n.t('general.anonymous')}</span>
19 ;
20
21 Box.propTypes = {
22         user: PropTypes.shape({
23                 discriminator: PropTypes.string,
24                 username: PropTypes.string,
25         }),
26 };
27
28 export default withTranslation()(Box);