-
Notifications
You must be signed in to change notification settings - Fork 0
/
Book.js
36 lines (29 loc) · 1.22 KB
/
Book.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class Book extends Component {
static propTypes = {
book: PropTypes.object,
updateBook: PropTypes.func
}
render() {
return (
<div className="book">
<div className="book-top">
<div className="book-cover" style={{ width: 128, height: 193, backgroundImage: `url(${this.props.book.imageLinks && (this.props.book.imageLinks.thumbnail)})` }}></div>
<div className="book-shelf-changer">
<select value={ (this.props.book.shelf) ? this.props.book.shelf : "none" } onChange={(event) => this.props.updateBook(this.props.book, event.target.value)}>
<option value="move" disabled>Move to...</option>
<option value="currentlyReading">Currently Reading</option>
<option value="wantToRead">Want to Read</option>
<option value="read">Read</option>
<option value="none">None</option>
</select>
</div>
</div>
<div className="book-title">{this.props.book.title}</div>
<div className="book-authors">{this.props.book.authors && (this.props.book.authors.join(", "))}</div>
</div>
);
}
}
export default Book