Skip to content

Commit

Permalink
Merge pull request #30 from tlanettepollard/developing
Browse files Browse the repository at this point in the history
Developing
  • Loading branch information
tlanettepollard authored May 15, 2022
2 parents c988e93 + d84ea5d commit 75803f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Book.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';

const Book = ({ book, newBookShelf }) => {
const Book = ({ book, newBookShelf, shelf }) => {



Expand All @@ -18,7 +18,7 @@ const Book = ({ book, newBookShelf }) => {
}}
></div>
<div className="book-shelf-changer">
<select defaultValue={book.shelf ? book.shelf : 'none'} onChange={e => newBookShelf(book, e.target.value)}>
<select defaultValue={shelf || (book.shelf ? book.shelf : 'none')} onChange={e => newBookShelf(book, e.target.value)}>
<option value="none" disabled>
Move to...
</option>
Expand Down
10 changes: 5 additions & 5 deletions src/components/SearchBooksPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Link } from 'react-router-dom';
import * as BooksAPI from '../BooksAPI';


const SearchBooksPage = ({ books, newBookShelf }) => {
const SearchBooksPage = ({ books, newBookShelf, shelf }) => {
const [query, setQuery] = useState('');
const [matchedBooks, setMatchedBooks] = useState([]);


const updateQuery = (query) => {
setQuery(query);
Expand Down Expand Up @@ -52,17 +52,17 @@ const SearchBooksPage = ({ books, newBookShelf }) => {
<div className="search-books-results">
<ol className="books-grid">
{query && matchedBooks.map((matchedBooks) => {
let shelf = 'none';
//let shelf = 'none';
books.map((book) => book.id === matchedBooks.id ? (shelf = book.shelf) : '');
return (
return (
<li key={matchedBooks.id}>
<Book
book={matchedBooks}
shelf={shelf}
newBookShelf={newBookShelf}
handleBooksSearch={handleBooksSearch}
/>
</li>
</li>
);
})}
</ol>
Expand Down

1 comment on commit 75803f9

@vercel
Copy link

@vercel vercel bot commented on 75803f9 May 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.