mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-03-12 13:31:17 +00:00
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
"use strict";
|
|
|
|
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
|
|
|
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
|
|
|
var PropTypes = require("../PropTypes");
|
|
var RouteHandler = require("./RouteHandler");
|
|
var Route = require("./Route");
|
|
|
|
/**
|
|
* A <DefaultRoute> component is a special kind of <Route> that
|
|
* renders when its parent matches but none of its siblings do.
|
|
* Only one such route may be used at any given level in the
|
|
* route hierarchy.
|
|
*/
|
|
|
|
var DefaultRoute = (function (_Route) {
|
|
function DefaultRoute() {
|
|
_classCallCheck(this, DefaultRoute);
|
|
|
|
if (_Route != null) {
|
|
_Route.apply(this, arguments);
|
|
}
|
|
}
|
|
|
|
_inherits(DefaultRoute, _Route);
|
|
|
|
return DefaultRoute;
|
|
})(Route);
|
|
|
|
// TODO: Include these in the above class definition
|
|
// once we can use ES7 property initializers.
|
|
// https://github.com/babel/babel/issues/619
|
|
|
|
DefaultRoute.propTypes = {
|
|
name: PropTypes.string,
|
|
path: PropTypes.falsy,
|
|
children: PropTypes.falsy,
|
|
handler: PropTypes.func.isRequired
|
|
};
|
|
|
|
DefaultRoute.defaultProps = {
|
|
handler: RouteHandler
|
|
};
|
|
|
|
module.exports = DefaultRoute; |