GoogleBookSearch/client/package.json
{
"name": "google-books",
"version": "0.1.0",
"description": "Google Books",
"private": true,
"proxy": "http://localhost:3001/",
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "^2.1.1",
"react-router-dom": "^5.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
GoogleBookSearch/client/public/images/mern.jpg
GoogleBookSearch/client/public/images/screenshot.gif
GoogleBookSearch/client/public/images/screenshot.png
GoogleBookSearch/client/public/index.html
You need to enable JavaScript to run this app.
GoogleBookSearch/client/public/manifest.json
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
GoogleBookSearch/client/src/App.css
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
GoogleBookSearch/client/src/App.js
import React, { Component } from "react";
import { BrowserRouter as Router, Route } from "react-router-dom";
import NavBar from "./components/NavBar";
import Header from "./components/Header";
import Wrapper from "./components/Wrapper";
import NoMatch from "./pages/NoMatch";
import Search from "./pages/Search";
import Saved from "./pages/Saved";
import "./App.css";
class App extends Component {
render() {
return (
)
};
};
export default App;
GoogleBookSearch/client/src/App.test.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(
, div);
ReactDOM.unmountComponentAtNode(div);
});
GoogleBookSearch/client/src/components/Form/index.js
import React from "react";
function Form(props){
return (
);
}
export default Form;
GoogleBookSearch/client/src/components/Header/index.js
import React from "react";
import style from "./style.css";
function Header() {
return (
);
}
export default Header;
GoogleBookSearch/client/src/components/Header/library.png
GoogleBookSearch/client/src/components/Header/style.css
.jumbotron .text-light{
color: #0c5460 !important;
}
.jumbotron{ background-color:#fff !important;
padding-top: 1% !important;
padding-bottom: 0px !important;}
.search {
border:1px solid #dee2e6;
border-radius:5px;
padding:2%;
margin-bottom:2%;
}
.result {
border:1px solid #dee2e6;
border-radius:5px;
padding:2%;
margin-bottom:2%;
}
.search .btn{background-color:#0c5460;}
.search h2{color:#0c5460;}
GoogleBookSearch/client/src/components/NavBar/index.js
import React from "react";
import { Link } from "react-router-dom";
import "./style.css";
function Navbar() {
return (
);
}
export default Navbar;
GoogleBookSearch/client/src/components/NavBar/style.css
nav {
background-color: #0c5460;
}
a {
text-decoration: none;
color: white
}
a:hover {
text-decoration: underline;
color: white
}
.navbar-brand {
font-size: 35px;
}
.nav-item {
font-size: 25px;
}
.nav-link:hover {
background-color:#fff;
color:#0c5460;
}
GoogleBookSearch/client/src/components/Results/index.js
import React, { Component } from "react";
import API from "../../utils/API";
class Results extends Component {
state = {
savedBooks: [],
}
componentDidMount() {
API.savedBooks()
.then(savedBooks => this.setState({ savedBooks: savedBooks }))
.catch(err => console.error(err));
}
handleSave = book => {
if (this.state.savedBooks.map(book => book._id).includes(book._id)) {
API.deleteBook(book._id)
.then(deletedBook => this.setState({ savedBooks: this.state.savedBooks.filter(book => book._id !== deletedBook._id) }))
.catch(err => console.error(err));
} else {
API.saveBook(book)
.then(savedBook => this.setState({ savedBooks: this.state.savedBooks.concat([savedBook]) }))
.catch(err => console.error(err));
}
}
render() {
return (
{!this.props.books.length ? (
No Results to Display
) : (
{this.props.books.map(result => (
...
SOLUTION.PDFAnswer To This Question Is Available To Download
Submit New Assignment
Please select references for your assignment
Please select no of pages for your assignment
Please select level for your assignment