import React from 'react'; export default class Tab extends React.PureComponent { constructor() { super(); this.handleHover = this.handleHover.bind(this); this.handleBlur = this.handleBlur.bind(this); this.handleClick = this.handleClick.bind(this); this.state = { hovered: false }; } handleHover() { this.setState({ hovered: true }); } handleBlur() { this.setState({ hovered: false }); } handleClick(event) { const isLeftClick = event.nativeEvent.which === 1; const isMiddleClick = event.nativeEvent.which === 2; if (isLeftClick && !this.props.isActive) { this.props.onSelect(); } else if (isMiddleClick) { this.props.onClose(); } } render() { const {isActive, isFirst, isLast, borderColor, hasActivity} = this.props; const {hovered} = this.state; return (
  • {this.props.customChildrenBefore} {this.props.text} {this.props.customChildren}
  • ); } }