opds-web-client
Version:
51 lines (50 loc) • 2.64 kB
JavaScript
"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 CatalogLink_1 = require("./CatalogLink");
var BookCover_1 = require("./BookCover");
var Book = (function (_super) {
__extends(Book, _super);
function Book() {
_super.apply(this, arguments);
}
Book.prototype.render = function () {
var bookStyle = {
whiteSpace: "normal",
marginRight: "10px",
marginBottom: "10px",
overflow: "hidden",
height: "200px",
float: "left",
textAlign: "center"
};
var bookInfoStyle = {
width: "160px",
textAlign: "left",
marginTop: "15px",
marginLeft: "5px",
float: "left"
};
var bookTitleStyle = {
fontSize: "1.2em",
fontWeight: "bold",
marginBottom: "5px"
};
var bookLinksStyle = {
marginTop: "10px"
};
return (React.createElement("div", {className: "book", style: bookStyle}, React.createElement(CatalogLink_1.default, {collectionUrl: this.props.collectionUrl, bookUrl: this.props.book.url || this.props.book.id, style: { color: "black", textDecoration: "none" }}, React.createElement(BookCover_1.default, {book: this.props.book})), React.createElement("div", {className: "bookInfo", style: bookInfoStyle}, React.createElement(CatalogLink_1.default, {collectionUrl: this.props.collectionUrl, bookUrl: this.props.book.url || this.props.book.id, style: { color: "black", textDecoration: "none" }}, React.createElement("div", {className: "bookTitle", style: bookTitleStyle}, this.props.book.title), React.createElement("div", {className: "bookAuthors"}, this.props.book.authors.length ?
this.props.book.authors.join(", ") :
this.props.book.contributors && this.props.book.contributors.length ?
this.props.book.contributors.join(", ") :
"")), this.props.book.openAccessLinks && this.props.book.openAccessLinks.length ?
React.createElement("div", {className: "bookLinks", style: bookLinksStyle}, React.createElement("a", {href: this.props.book.openAccessLinks[0].url, className: "btn btn-default"}, "Download")) : null)));
};
return Book;
}(React.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Book;