const {Component, PropTypes} = require('react') const {MenuItem, IconMenu, IconButton} = require('material-ui') const {muiThemeable} = require('material-ui/styles') const Color = require('color') class UserBadge extends Component{ renderMenu(){ if (!this.props.menus || !this.props.menus.length) { return null; } const menuItems = this.props.menus.map(function(m){ let rightIcon; if(m.checked){ rightIcon = ; } return ( ); }); const iconStyle = {fontSize: 18}; return( } anchorOrigin={{horizontal: 'right', vertical: 'top'}} targetOrigin={{horizontal: 'right', vertical: 'top'}} > {menuItems} ); } render() { let avatar; let avatarColor = this.props.muiTheme.palette.avatarsColor; if(this.props.type == 'group') { avatarColor = Color(avatarColor).darken(.2).toString(); avatar = ; }else if(this.props.type == 'team') { avatarColor = Color(avatarColor).darken(.2).toString(); avatar = ; }else if(this.props.type == 'temporary') { avatarColor = Color(avatarColor).lighten(.2).toString(); avatar = ; }else if(this.props.type == 'remote_user'){ avatar = ; }else{ avatar = ; } const menu = this.renderMenu(); return (
{avatar} {this.props.label} {this.props.children} {menu}
); } } UserBadge.propTypes = { label : PropTypes.string, avatar : PropTypes.string, type : PropTypes.string, menus : PropTypes.object, muiTheme: PropTypes.object, }; UserBadge = muiThemeable()(UserBadge); export {UserBadge as default}