mattermost-desktop/src/browser/components/TeamListItem.jsx

61 lines
1.4 KiB
React
Raw Normal View History

2016-11-01 07:46:13 -07:00
const React = require('react');
2017-05-11 08:04:27 -07:00
const PropTypes = require('prop-types');
2016-11-01 07:46:13 -07:00
class TeamListItem extends React.Component {
2016-11-18 22:30:22 -08:00
constructor(props) {
super(props);
this.handleTeamRemove = this.handleTeamRemove.bind(this);
this.handleTeamEditing = this.handleTeamEditing.bind(this);
}
2016-11-01 07:46:13 -07:00
handleTeamRemove() {
this.props.onTeamRemove();
}
handleTeamEditing() {
this.props.onTeamEditing();
}
render() {
var style = {
left: {
display: 'inline-block',
width: 'calc(100% - 100px)',
cursor: 'pointer'
2016-11-01 07:46:13 -07:00
}
};
return (
<div className='teamListItem list-group-item'>
<div
style={style.left}
onClick={this.props.onTeamClick}
>
2016-11-01 07:46:13 -07:00
<h4 className='list-group-item-heading'>{ this.props.name }</h4>
<p className='list-group-item-text'>
{ this.props.url }
</p>
</div>
<div className='pull-right'>
<a
href='#'
onClick={this.handleTeamEditing}
>{'Edit'}</a>
{' - '}
<a
href='#'
onClick={this.handleTeamRemove}
>{'Remove'}</a>
</div>
</div>
);
}
}
TeamListItem.propTypes = {
2017-05-11 08:04:27 -07:00
name: PropTypes.string,
onTeamEditing: PropTypes.func,
onTeamRemove: PropTypes.func,
onTeamClick: PropTypes.func,
url: PropTypes.string
2016-11-01 07:46:13 -07:00
};
module.exports = TeamListItem;