-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0f0dbe
commit 58fdb9d
Showing
26 changed files
with
461 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import './App.styles.jsx'; | ||
import "./App.styles.jsx"; | ||
import * as S from "./App.styles"; | ||
import { FC } from "react"; | ||
import Main from './pages/main'; | ||
import Main from "./pages/main"; | ||
import { BrowserRouter, Routes, Route } from "react-router-dom"; | ||
import { useSelector } from "react-redux"; | ||
import DescriptionPage from "pages/description"; | ||
import { IDataBooks } from "types/index.js"; | ||
|
||
const App:FC = ():JSX.Element => { | ||
const url = useSelector((state: IDataBooks) => state.books.id); | ||
|
||
return ( | ||
<S.Container> | ||
<Main /> | ||
</S.Container> | ||
); | ||
} | ||
return ( | ||
<BrowserRouter> | ||
<S.Container> | ||
<Routes> | ||
<Route path="/*" element={<Main />} /> | ||
<Route path={`${url}`} element={<DescriptionPage />} /> | ||
</Routes> | ||
</S.Container> | ||
</BrowserRouter> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,9 @@ | ||
export const kindSortButtons = [ | ||
{ | ||
name: "All", | ||
}, | ||
{ | ||
name: "Art", | ||
}, | ||
{ | ||
name: "Biography", | ||
}, | ||
{ | ||
name: "Computers", | ||
}, | ||
{ | ||
name: "History", | ||
}, | ||
{ | ||
name: "Medical", | ||
}, | ||
{ | ||
name: "Poetry", | ||
}, | ||
{ name: "All" }, | ||
{ name: "Art" }, | ||
{ name: "Biography" }, | ||
{ name: "Computers" }, | ||
{ name: "History" }, | ||
{ name: "Medical" }, | ||
{ name: "Poetry" }, | ||
]; |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
const API__KEY = `AIzaSyAPez01RNSc-o39SVYSn2nSeDiVyRHGLCo`; | ||
export const basicUrl = `https://www.googleapis.com/books/v1/volumes`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import axios from "axios"; | ||
import { localString } from "types"; | ||
import { basicUrl } from "../constant"; | ||
|
||
export const getBooksApi = (action: any) => { | ||
const response = axios.get(`${basicUrl}?q=${action}&maxResults=40`); | ||
export const getBooksApi = (queryParams:localString) => { | ||
const response = axios.get(`${basicUrl}?=${queryParams}&maxResults=40`); | ||
return response; | ||
}; | ||
|
||
export const getSortingBooksApi = (action: any) => { | ||
const response = axios.get(`${basicUrl}?q=${action}&maxResults=40`); | ||
export const getSortingBooksApi = (queryParams:localString) => { | ||
const response = axios.get(`${basicUrl}?q=${queryParams}&maxResults=40`); | ||
return response; | ||
}; | ||
|
||
export const getBookByIDApi = (action: any) => { | ||
console.log('response in last function') | ||
const response = axios.get(`${basicUrl}/${action}`); | ||
console.log('response in last function', response) | ||
export const getBookByIDApi = (queryParams:localString) => { | ||
const response = axios.get(`${basicUrl}/${queryParams}`); | ||
return response; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Container = styled.div` | ||
display: flex; | ||
max-width: 1400px; | ||
width: 100%; | ||
justify-content: space-around; | ||
align-items: center; | ||
min-height: 700px; | ||
background-color: #cdcdcd; | ||
border-radius: 20px; | ||
img { | ||
max-width: 700px; | ||
width: 100%; | ||
height: 500px; | ||
} | ||
.container__label { | ||
max-width: 400px; | ||
width: 100%; | ||
} | ||
.container__description { | ||
max-width: 700px; | ||
width: 100%; | ||
.name { | ||
max-width: 300px; | ||
width: 100%; | ||
} | ||
.categories { | ||
max-width: 300px; | ||
width: 100%; | ||
} | ||
.authors { | ||
max-width: 300px; | ||
width: 100%; | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import * as S from "./index.styles"; | ||
import { useSelector } from "react-redux"; | ||
import { Button } from "components/button"; | ||
import { Link } from "react-router-dom"; | ||
import { MagnifyingGlass } from "react-loader-spinner"; | ||
import { ICurrentState, IState } from "types"; | ||
|
||
const DescriptionPage = () => { | ||
const bookImage = useSelector( | ||
(state:ICurrentState) => state.books.book.data?.volumeInfo.imageLinks.smallThumbnail, | ||
); | ||
const bookName = useSelector( | ||
(state:ICurrentState) => state.books.book.data?.volumeInfo.title, | ||
); | ||
const bookCategories = useSelector( | ||
(state:ICurrentState) => state.books.book.data?.volumeInfo.categories, | ||
); | ||
const bookAuthors = useSelector( | ||
(state:ICurrentState) => state.books.book.data?.volumeInfo.authors, | ||
); | ||
const bookDescription = useSelector( | ||
(state:ICurrentState) => state.books.book.data?.volumeInfo.description, | ||
); | ||
const isLoading = useSelector((state:IState) => state.books?.loading); | ||
|
||
return ( | ||
<S.Container> | ||
{isLoading ? ( | ||
<MagnifyingGlass | ||
visible={true} | ||
height="110" | ||
width="110" | ||
ariaLabel="MagnifyingGlass-loading" | ||
wrapperStyle={{ marginTop: "10px" }} | ||
wrapperClass="MagnifyingGlass-wrapper" | ||
glassColor="#c0efff" | ||
color="#bb7d81" | ||
/> | ||
) : ( | ||
<> | ||
<Link to="/*"> | ||
<Button buttonName={"Back"} className={"backbutton"} /> | ||
</Link> | ||
<div className="container__label"> | ||
<img src={bookImage} alt="label of book" /> | ||
</div> | ||
<div className="container__description"> | ||
<p className="name"> | ||
Name: <span className="namingBook">{bookName}</span> | ||
</p> | ||
<p className="categories"> | ||
Categories: <span className="namingBook">{bookCategories}</span> | ||
</p> | ||
<p className="authors"> | ||
Authors: <span className="namingBook">{bookAuthors}</span> | ||
</p> | ||
<p className="description"> | ||
Description: <span className="namingBook">{bookDescription}</span> | ||
</p> | ||
</div> | ||
</> | ||
)} | ||
</S.Container> | ||
); | ||
}; | ||
|
||
export default DescriptionPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.