You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
10 years ago
|
var React = require('react');
|
||
|
|
||
|
var NavItem = require('react-bootstrap/lib/NavItem');
|
||
|
var LinkMixin = require('./LinkMixin');
|
||
|
|
||
|
var NavItemLink = React.createClass({displayName: "NavItemLink",
|
||
|
mixins: [
|
||
|
LinkMixin
|
||
|
],
|
||
|
contextTypes: {
|
||
|
router: React.PropTypes.func.isRequired
|
||
|
},
|
||
|
|
||
|
render: function() {
|
||
|
var $__0=
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
this.props,to=$__0.to,params=$__0.params,query=$__0.query,active=$__0.active,props=(function(source, exclusion) {var rest = {};var hasOwn = Object.prototype.hasOwnProperty;if (source == null) {throw new TypeError();}for (var key in source) {if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {rest[key] = source[key];}}return rest;})($__0,{to:1,params:1,query:1,active:1});
|
||
|
|
||
|
if (this.props.active === undefined) {
|
||
|
active = this.context.router.isActive(to, params, query);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
React.createElement(NavItem, React.__spread({}, props,
|
||
|
{href: this.getHref(),
|
||
|
active: active,
|
||
|
onClick: this.handleRouteTo,
|
||
|
ref: "navItem"}),
|
||
|
this.props.children
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
module.exports = NavItemLink;
|