react-bootstrap
Version:
Bootstrap 3 components build with React
59 lines (50 loc) • 1.43 kB
JavaScript
define(function (require, exports, module) {var React = require('react');
var joinClasses = require('./utils/joinClasses');
var classSet = require('./utils/classSet');
var PageItem = React.createClass({displayName: "PageItem",
propTypes: {
href: React.PropTypes.string,
target: React.PropTypes.string,
disabled: React.PropTypes.bool,
previous: React.PropTypes.bool,
next: React.PropTypes.bool,
onSelect: React.PropTypes.func,
eventKey: React.PropTypes.any
},
getDefaultProps: function () {
return {
href: '#'
};
},
render: function () {
var classes = {
'disabled': this.props.disabled,
'previous': this.props.previous,
'next': this.props.next
};
return (
React.createElement("li", React.__spread({},
this.props,
{className: joinClasses(this.props.className, classSet(classes))}),
React.createElement("a", {
href: this.props.href,
title: this.props.title,
target: this.props.target,
onClick: this.handleSelect,
ref: "anchor"},
this.props.children
)
)
);
},
handleSelect: function (e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
}
});
module.exports = PageItem;
});