UNPKG

opds-web-client

Version:
51 lines (50 loc) 2.34 kB
"use strict"; 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 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 laneBooksStyle = { display: "block", height: "260px", width: "100%", whiteSpace: "nowrap", overflowX: "scroll", overflowY: "hidden", padding: 0, margin: 0, listStyleType: "none" }; var visibleBooks = this.visibleBooks(); if (visibleBooks.length === 0) { return null; } return (React.createElement("div", {className: "lane"}, React.createElement("h2", {style: { clear: "both", cursor: "pointer" }}, React.createElement(CatalogLink_1.default, {className: "laneTitle", collectionUrl: this.props.lane.url}, this.props.lane.title)), React.createElement("ul", {className: "laneBooks", "aria-label": "books in " + this.props.lane.title, style: laneBooksStyle}, visibleBooks.map(function (book) { return React.createElement("li", {key: book.id, style: { display: "inline-block" }}, React.createElement(LaneBook_1.default, {book: book, collectionUrl: _this.props.collectionUrl})); }), !this.props.hideMoreLink && React.createElement("li", {key: "more", style: { display: "inline-block" }}, 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;