diff --git a/package.json b/package.json index be5083ad17..84944a28e9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "dependencies": { "prop-types": "^15.5.8", "react": "^15.5.4", - "react-dom": "^15.5.4" + "react-dom": "^15.5.4", + "react-router-dom": "^4.1.2" }, "devDependencies": { "react-scripts": "0.9.5" @@ -12,5 +13,18 @@ "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app", + "globals": { + "jasmine": true + }, + "rules": { + "semi": ["warn", "always"], + "indent": ["error", 2], + "comma-dangle": ["error", "always-multiline"], + "object-curly-spacing": ["error", "never"], + "no-use-before-define": 0 + } } } diff --git a/src/App.js b/src/App.js index a85e8bb1a2..d1bd2fd0ad 100644 --- a/src/App.js +++ b/src/App.js @@ -1,206 +1,288 @@ -import React from 'react' -import * as BooksAPI from './BooksAPI' -import './App.css' +import React, {Component} from 'react'; +import {BrowserRouter as Router, Route, Link} from 'react-router-dom'; -class BooksApp extends React.Component { - state = { - /** - * TODO: Instead of using this state variable to keep track of which page - * we're on, use the URL in the browser's address bar. This will ensure that - * users can use the browser's back and forward buttons to navigate between - * pages, as well as provide a good URL they can bookmark and share. - */ - showSearchPage: true - } +import './App.css'; - render() { - return ( -
- {this.state.showSearchPage ? ( -
-
- this.setState({ showSearchPage: false })}>Close -
- {/* - NOTES: The search from BooksAPI is limited to a particular set of search terms. - You can find these search terms here: - https://github.com/udacity/reactnd-project-myreads-starter/blob/master/SEARCH_TERMS.md - - However, remember that the BooksAPI.search method DOES search by title or author. So, don't worry if - you don't find a specific author or title. Every search is limited by search terms. - */} - - -
-
-
-
    -
    +const BookShelf = () => +
    +
    +

    MyReads

    +
    +
    +
    +
    +

    Currently Reading

    +
    +
      +
    1. +
      +
      +
      +
      + +
      +
      +
      To Kill a Mockingbird
      +
      Harper Lee
      +
      +
    2. +
    3. +
      +
      +
      +
      + +
      +
      +
      Ender's Game
      +
      Orson Scott Card
      +
      +
    4. +
    +
    +
    +
    +

    Want to Read

    +
    +
      +
    1. +
      +
      +
      +
      + +
      +
      +
      1776
      +
      David McCullough
      +
      +
    2. +
    3. +
      +
      +
      +
      + +
      +
      +
      + Harry Potter and the Sorcerer's Stone +
      +
      J.K. Rowling
      +
      +
    4. +
    - ) : ( -
    -
    -

    MyReads

    -
    -
    -
    -
    -

    Currently Reading

    -
    -
      -
    1. -
      -
      -
      -
      - -
      -
      -
      To Kill a Mockingbird
      -
      Harper Lee
      -
      -
    2. -
    3. -
      -
      -
      -
      - -
      -
      -
      Ender's Game
      -
      Orson Scott Card
      -
      -
    4. -
    +
    +
    +

    Read

    +
    +
      +
    1. +
      +
      +
      +
      + +
      +
      The Hobbit
      +
      J.R.R. Tolkien
      -
      -

      Want to Read

      -
      -
        -
      1. -
        -
        -
        -
        - -
        -
        -
        1776
        -
        David McCullough
        -
        -
      2. -
      3. -
        -
        -
        -
        - -
        -
        -
        Harry Potter and the Sorcerer's Stone
        -
        J.K. Rowling
        -
        -
      4. -
      +
    2. +
    3. +
      +
      +
      +
      + +
      +
      Oh, the Places You'll Go!
      +
      Seuss
      -
      -

      Read

      -
      -
        -
      1. -
        -
        -
        -
        - -
        -
        -
        The Hobbit
        -
        J.R.R. Tolkien
        -
        -
      2. -
      3. -
        -
        -
        -
        - -
        -
        -
        Oh, the Places You'll Go!
        -
        Seuss
        -
        -
      4. -
      5. -
        -
        -
        -
        - -
        -
        -
        The Adventures of Tom Sawyer
        -
        Mark Twain
        -
        -
      6. -
      +
    4. +
    5. +
      +
      +
      +
      + +
      +
      The Adventures of Tom Sawyer
      +
      Mark Twain
      -
      -
    - + +
    - )} +
    - ) +
    +
    + Add a book +
    +
    ; +const Search = () => +
    +
    + + Close + +
    + {/* + NOTES: The search from BooksAPI is limited to a particular set of search terms. + You can find these search terms here: + https://github.com/udacity/reactnd-project-myreads-starter/blob/master/SEARCH_TERMS.md + + However, remember that the BooksAPI.search method DOES search by title or author. So, don't worry if + you don't find a specific author or title. Every search is limited by search terms. + */} + +
    +
    +
    +
      +
    +
    ; + +class App extends Component { + render() { + return ( + +
    + + +
    +
    + ); } } -export default BooksApp +export default App;