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

65 lines
1.3 KiB
React
Raw Normal View History

2017-07-28 21:43:39 +08:00
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
2017-07-28 21:43:39 +08:00
2018-01-08 14:17:18 +08:00
import { styles } from './styles';
const propTypes = {
2017-07-28 21:43:39 +08:00
children: PropTypes.node.isRequired,
moderator: PropTypes.bool.isRequired,
presenter: PropTypes.bool.isRequired,
talking: PropTypes.bool.isRequired,
muted: PropTypes.bool.isRequired,
listenOnly: PropTypes.bool.isRequired,
voice: PropTypes.bool.isRequired,
color: PropTypes.string,
className: PropTypes.string,
};
const defaultProps = {
2017-07-28 21:43:39 +08:00
moderator: false,
presenter: false,
talking: false,
muted: false,
listenOnly: false,
voice: false,
color: '#000',
2017-10-11 06:08:51 +08:00
className: null,
};
2017-07-28 21:43:39 +08:00
const UserAvatar = ({
children,
moderator,
presenter,
talking,
muted,
listenOnly,
color,
voice,
className,
}) => (
<div
className={cx(styles.avatar, {
[styles.moderator]: moderator,
[styles.presenter]: presenter,
[styles.muted]: muted,
[styles.listenOnly]: listenOnly,
[styles.talking]: (talking && !muted),
2017-07-28 21:43:39 +08:00
[styles.voice]: voice,
}, className)}
style={{
backgroundColor: color,
color, // We need the same color on both for the border
}}
>
<div className={styles.content}>
{children}
</div>
</div>
);
UserAvatar.propTypes = propTypes;
UserAvatar.defaultProps = defaultProps;
2017-07-28 21:43:39 +08:00
export default UserAvatar;