bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/user-avatar/component.jsx

39 lines
984 B
React
Raw Normal View History

import React, { Component, PropTypes } from 'react';
import styles from './styles.scss';
import cx from 'classnames';
const propTypes = {
user: React.PropTypes.shape({
name: React.PropTypes.string.isRequired,
isPresenter: React.PropTypes.bool.isRequired,
isVoiceUser: React.PropTypes.bool.isRequired,
isModerator: React.PropTypes.bool.isRequired,
image: React.PropTypes.string,
}).isRequired,
};
const defaultProps = {
};
export default class UserAvatar extends Component {
render() {
let user = this.props.user;
let avatarClasses = {};
avatarClasses[styles.presenter] = user.isPresenter;
avatarClasses[styles.voiceUser] = user.isVoiceUser;
avatarClasses[styles.moderator] = user.isModerator;
return (
<div className={cx(avatarClasses, styles.userAvatar)}>
<span>
2016-06-28 21:10:20 +08:00
{user.name.slice(0, 2)}
</span>
</div>
);
}
}
UserAvatar.propTypes = propTypes;
UserAvatar.defaultProps = defaultProps;