forked from react-bootstrap/react-bootstrap-bower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPageItem.js
55 lines (47 loc) · 1.27 KB
/
PageItem.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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: {
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,
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);
}
}
}
});
module.exports = PageItem;
});