Added funcaitonality to onSelectChange
This commit is contained in:
@@ -22,8 +22,13 @@ class BooksApp extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSelectChange = (e) => {
|
onSelectChange = (e) => {
|
||||||
|
const id = e.target.name
|
||||||
const shelf = e.target.value
|
const shelf = e.target.value
|
||||||
|
console.log(id, shelf)
|
||||||
|
|
||||||
|
this.setState((prevState) => {
|
||||||
|
prevState.filter(name === book.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Bookshelf extends Component {
|
|||||||
const books = this.props.books
|
const books = this.props.books
|
||||||
const onSelect = this.props.onSelect
|
const onSelect = this.props.onSelect
|
||||||
|
|
||||||
console.log(books)
|
// console.log(books)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class Bookshelf extends Component {
|
|||||||
<div className="book-top">
|
<div className="book-top">
|
||||||
<div className="book-cover" style={{ width: 128, height: 193, backgroundImage: `url("${ book.imageLinks.thumbnail }")` }}></div>
|
<div className="book-cover" style={{ width: 128, height: 193, backgroundImage: `url("${ book.imageLinks.thumbnail }")` }}></div>
|
||||||
<div className="book-shelf-changer">
|
<div className="book-shelf-changer">
|
||||||
<select onChange={onSelect}>
|
<select name={book.id} onChange={onSelect}>
|
||||||
<option value="none" disabled>Move to...</option>
|
<option value="none" disabled>Move to...</option>
|
||||||
<option value="currentlyReading">Currently Reading</option>
|
<option value="currentlyReading">Currently Reading</option>
|
||||||
<option value="wantToRead">Want to Read</option>
|
<option value="wantToRead">Want to Read</option>
|
||||||
|
|||||||
Reference in New Issue
Block a user