opds-web-client
Version:
37 lines (36 loc) • 1.71 kB
JavaScript
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var React = require("react");
var UrlForm = (function (_super) {
__extends(UrlForm, _super);
function UrlForm(props) {
var _this = _super.call(this, props) || this;
_this.onSubmit = _this.onSubmit.bind(_this);
return _this;
}
UrlForm.prototype.render = function () {
var placeholder = "e.g. http://feedbooks.github.io/opds-test-catalog/catalog/root.xml";
return (React.createElement("div", { className: "url-form" },
React.createElement("h2", null, "View OPDS Feed"),
React.createElement("form", { onSubmit: this.onSubmit, className: "form-inline" },
React.createElement("input", { ref: "input", name: "collection", type: "text", className: "form-control input-lg", defaultValue: this.props.collectionUrl, placeholder: placeholder }),
"\u00A0",
React.createElement("button", { type: "submit", className: "btn btn-lg btn-default" }, "Go"))));
};
UrlForm.prototype.onSubmit = function (event) {
var url = this.refs["input"]["value"];
this.context.router.push(this.context.pathFor(url, null));
event.preventDefault();
};
return UrlForm;
}(React.Component));
UrlForm.contextTypes = {
router: React.PropTypes.object.isRequired,
pathFor: React.PropTypes.func.isRequired
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = UrlForm;
;