opds-web-client
Version:
41 lines (40 loc) • 1.93 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");
require("../stylesheets/lane.scss");
var LaneBook_1 = require("./LaneBook");
var CatalogLink_1 = require("./CatalogLink");
var LaneMoreLink_1 = require("./LaneMoreLink");
var Lane = (function (_super) {
__extends(Lane, _super);
function Lane() {
_super.apply(this, arguments);
}
Lane.prototype.render = function () {
var _this = this;
var visibleBooks = this.visibleBooks();
if (visibleBooks.length === 0) {
return null;
}
return (React.createElement("div", {className: "lane"}, React.createElement("h2", null, React.createElement(CatalogLink_1.default, {className: "title", collectionUrl: this.props.lane.url}, this.props.lane.title)), React.createElement("ul", {className: "lane-books", "aria-label": "books in " + this.props.lane.title}, visibleBooks.map(function (book) {
return React.createElement("li", {key: book.id}, React.createElement(LaneBook_1.default, {book: book, collectionUrl: _this.props.collectionUrl}));
}), !this.props.hideMoreLink &&
React.createElement("li", {key: "more"}, React.createElement(LaneMoreLink_1.default, {lane: this.props.lane})))));
};
Lane.prototype.visibleBooks = function () {
var _this = this;
if (!this.props.hiddenBookIds) {
return this.props.lane.books;
}
return this.props.lane.books.filter(function (book) {
return _this.props.hiddenBookIds.indexOf(book.id) === -1;
});
};
return Lane;
}(React.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Lane;
;