2016-08-31 23:15:12 +09:00
|
|
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|
|
|
|
2016-08-26 02:52:55 +09:00
|
|
|
const Button = React.createClass({
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2016-08-26 02:52:55 +09:00
|
|
|
propTypes: {
|
|
|
|
text: React.PropTypes.string.isRequired,
|
2016-08-31 23:15:12 +09:00
|
|
|
onClick: React.PropTypes.func,
|
|
|
|
disabled: React.PropTypes.boolean
|
2016-08-26 02:52:55 +09:00
|
|
|
},
|
|
|
|
|
2016-08-31 23:15:12 +09:00
|
|
|
mixins: [PureRenderMixin],
|
|
|
|
|
2016-08-26 02:52:55 +09:00
|
|
|
handleClick (e) {
|
|
|
|
e.preventDefault();
|
2016-08-31 23:15:12 +09:00
|
|
|
|
|
|
|
if (!this.props.disabled) {
|
|
|
|
this.props.onClick();
|
|
|
|
}
|
2016-08-26 02:52:55 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<a href='#' onClick={this.handleClick} style={{ display: 'inline-block', position: 'relative', boxSizing: 'border-box', textAlign: 'center', border: '10px none', backgroundColor: '#2b90d9', color: '#fff', fontSize: '14px', fontWeight: '500', letterSpacing: '0', textTransform: 'uppercase', padding: '0 16px', height: '36px', cursor: 'pointer', lineHeight: '36px', borderRadius: '4px', textDecoration: 'none' }}>
|
|
|
|
{this.props.text}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Button;
|