MyReads is a project from React Developer Nanodegree. Built on top of the starter template.
- Bootstrap 4;
- Loading state for shelves and search;
- Tests;
To get started developing right away:
- install all project dependencies with
npm install
- start the development server with
npm start
- launches tests
npm test
├── README.md - This file.
├── SEARCH_TERMS.md # The whitelisted short collection of available search terms for you to use with your app.
├── package.json # npm package manager file.
├── public
│ ├── favicon.ico # Book Icon.
│ └── index.html
└── src
├── components # Components folder.
| ├── __tests__ # Tests for common components.
| | ├── Alert.test.js # Tests for <Alert /> component.
| | ├── Badge.test.js # Tests for <Badge /> component.
| | ├── Loading.test.js # Tests for <Loading /> component.
| | └── NavBar.test.js # Tests for <NavBar /> component.
│ ├── Books # Book's components.
| | ├── __tests__ # Tests for book components.
| | | ├── Book.test.js # Tests for <Book /> component.
| | | ├── BookList.test.js # Tests for <BookList /> component.
| | | ├── BookSearch.test.js # Tests for <BookSearch /> component.
| | | └── BookShelf.test.js # Tests for <BookShelf /> component.
| | ├── Book.js # <Book /> component. Render individual book.
| | ├── BookList.js # <BookList /> component. Render a list of books.
| | ├── BookSearch.js # <BookSearch /> component. Render input and BookList component after successfull search.
| | └── BookShelf.js # <BookShelf /> component. Render BookSearch or BookList with three shelfs.
│ ├── Alert.js # <Alert /> component. Render alert div with a message and badge (if declarated).
│ ├── Badge.js # <Badge /> component.
│ ├── Loading.js # <Loading /> component. Render loading image.
│ └── Navbar.js # <NavBar /> component. Render navigation bar.
├── icons # Helpful icons.
│ └── loading.svg
├── utils
| ├── BooksAPI.js # A JavaScript API for the provided Udacity backend.
| └── custom.css # Define custom class for aplcation.
├── App.js # <App /> component. Start rendering bookshelf.
├── App.test.js # Tests for <App /> component.
├── index.js # ReactDOM root render.
└── setupTests.js # Configure enzyme.
Udacity provided a backend server for you to develop against. The provided file BooksAPI.js
contains the methods you will need to perform necessary operations on the backend:
Method Signature:
getAll()
- Returns a Promise which resolves to a JSON object containing a collection of book objects.
- This collection represents the books currently in the bookshelves in your app.
Method Signature:
update(book, shelf)
- book:
<Object>
containing at minimum anid
attribute - shelf:
<String>
contains one of ["wantToRead", "currentlyReading", "read"] - Returns a Promise which resolves to a JSON object containing the response data of the POST request
Method Signature:
search(query, maxResults)
- query:
<String>
- maxResults:
<Integer>
Due to the nature of the backend server, search results are capped at 20, even if this is set higher. - Returns a Promise which resolves to a JSON object containing a collection of book objects.
- These books do not know which shelf they are on. They are raw results only. You'll need to make sure that books have the correct state while on the search page.
The backend API uses a fixed set of cached search results and is limited to a particular set of search terms, which can be found in SEARCH_TERMS.md. That list of terms are the only terms that will work with the backend, so don't be surprised if your searches for Basket Weaving or Bubble Wrap don't come back with any results.
This project was bootstrapped with Create React App. You can find more information on how to perform common tasks here.