blob: e3ac63d87b3ac68e694202572ac0e9b64d918a2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
const TextIconButton = React.createClass({
propTypes: {
label: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
active: React.PropTypes.bool,
onClick: React.PropTypes.func.isRequired
},
mixins: [PureRenderMixin],
handleClick (e) {
e.preventDefault();
this.props.onClick();
},
render () {
const { label, title, active } = this.props;
return (
<button title={title} aria-label={title} className={`text-icon-button ${active ? 'active' : ''}`} onClick={this.handleClick}>
{label}
</button>
);
}
});
export default TextIconButton;
|