dispatch/client/src/js/components/TabListItem.js

28 lines
572 B
JavaScript
Raw Normal View History

2015-12-28 23:34:32 +00:00
import React, { Component } from 'react';
import pure from 'pure-render-decorator';
@pure
export default class TabListItem extends Component {
2016-01-05 18:29:22 +00:00
handleClick = () => {
const { server, target, onClick } = this.props;
onClick(server, target);
};
2016-01-05 18:29:22 +00:00
2015-12-28 23:34:32 +00:00
render() {
2016-01-05 18:29:22 +00:00
const { target, content, selected } = this.props;
2015-12-28 23:34:32 +00:00
const classes = [];
2016-01-05 18:29:22 +00:00
if (!target) {
2015-12-28 23:34:32 +00:00
classes.push('tab-server');
}
2016-01-05 18:29:22 +00:00
if (selected) {
2015-12-28 23:34:32 +00:00
classes.push('selected');
}
return (
2016-01-05 18:29:22 +00:00
<p className={classes.join(' ')} onClick={this.handleClick}>{content}</p>
2015-12-28 23:34:32 +00:00
);
}
}