Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foton Challenge - Mateus Pacheco #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
51 changes: 9 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,13 @@
# Frontend Challenge
# Clone this project
$ git clone https://github.com/mateushedp/frontend-challenge

Clone this repository and start our challenge **right now**
# cd into folder
$ cd frontend-challenge

Use React or React Native depending on the rule you are running for.
# Install dependencies
$ npm install

**NOTE:** If you have any questions regarding the test, just send us your question on our Discord's channel **#technical-challenge** on [Foton Discord](https://discord.gg/uw55aDewNf).
# Run the project
$ npm start

## API

Use the [Google Books](https://developers.google.com/books/docs/v1/using)' API to recover the data that will be shown on the app.

```js
const query = 'harry potter';
fetch(`https://www.googleapis.com/books/v1/volumes?q=${query}`);
```

**NOTE:** You can use the form of calling apis of your choice (Fetch, Axios, etc).

## Design/Screens
https://www.figma.com/file/KFElqzD983WNyvMY1SaF0c/book-app?node-id=0%3A1

<img width="581" alt="Screen Shot 2021-04-13 at 10 19 47" src="https://user-images.githubusercontent.com/13947203/114559257-eb55ad00-9c41-11eb-9617-4e7627cc373e.png">


The website design has 3 screens, which are:

### Home

1. Create a Pixel Perfect screen based on design above;
2. The books must be clickable and redirect to **details** screen.

### Search

In this screen the functionalities below are **mandatory**:

1. See a list of books based on search query;
2. Make it possible to search for more books with a "Load more" button;
3. Search books by name;
4. Click on one of the books to see their details.

### Books details

In this screen the functionalities below are **mandatory**:

1. See all information for the selected book.
### The project was made using Iphone X viewport as reference.
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "foton",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.4",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"eslint": "^7.28.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint-config-react": "^1.1.7"
}
}
Binary file added public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
38 changes: 38 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.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);
}
}
18 changes: 18 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import './App.css';
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import { Details } from './pages/Details';
import { Main } from './pages/Main';


function App() {
return (
<Router>
<Switch>
<Route component={Details} path="/details" />
<Route component={Main} path="/" />
</Switch>
</Router>
);
}

export default App;
27 changes: 27 additions & 0 deletions src/components/BottomBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.BottomBar {
position: fixed;
width: 375px !important;
height: 60px;
background-color: #FFFCF9;
bottom: 0;
margin-left: -20px;
display: flex;
justify-content: space-around;
}

.BottomBarButton {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

.BottomBarButton div p {
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
}

.ActiveButton p {
color: black;
}
37 changes: 37 additions & 0 deletions src/components/BottomBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import Grid from '@material-ui/core/Grid';
import IconButton from '@material-ui/core/IconButton';


import HomeIcon from '../images/icons/HomeIcon.png';
import LibrariesIcon from '../images/icons/BookClosedIcon.png'
import ProfileIcon from '../images/icons/UserIcon.png'

import './BottomBar.css';

export const BottomBar = (props) => {
const { setQuery } = props;

return (
<Grid container xs={12} className="BottomBar">
<IconButton item xs={4} active className="BottomBarButton ActiveButton" onClick={() => {setQuery('')}}>
<div>
<img src={HomeIcon} alt="" />
<p>Home</p>
</div>
</IconButton>
<IconButton item xs={4} className="BottomBarButton">
<div>
<img src={LibrariesIcon} alt="" />
<p>Libraries</p>
</div>
</IconButton>
<IconButton item xs={4} className="BottomBarButton">
<div>
<img src={ProfileIcon} alt="" />
<p>Profile</p>
</div>
</IconButton>
</Grid>
)
}
34 changes: 34 additions & 0 deletions src/components/DetailsActions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DetailsActions {
display: flex;
justify-content: space-around;
background-color: #FFFCF9;
width: calc(100% - 40px) !important;
height: 56px;
position: fixed;
bottom: 0;
margin-bottom: 50px;
box-shadow: 3px 3px 23px rgba(107, 103, 70, 0.12);
border-radius: 2px;

}

.DetailsActionsButton div {
display: flex;
align-items: center;
}

.DetailsActionsButton div p {
margin-top: 0;
margin-bottom: 0;
margin-left: 10px;
font-family: SfProDisplayBold;
font-size: 14px;
color: #3F4043;
}

.MiddleButton {
padding-right: 20px;
padding-left: 20px;
border-right: 2px solid rgba(151, 151, 151, 0.2);
border-left: 2px solid rgba(151, 151, 151, 0.2);
}
36 changes: 36 additions & 0 deletions src/components/DetailsActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import Grid from '@material-ui/core/Grid';
import IconButton from '@material-ui/core/IconButton';

import ReadIcon from '../images/icons/BookOpenIcon.png';
import ListenIcon from '../images/icons/HeadphonesIcon.png';
import ShareIcon from '../images/icons/ShareIcon.png';

import './DetailsActions.css'

export const DetailsActions = () => {
return (
<Grid container xs={12} className="DetailsActions">
<IconButton item xs={4} className="DetailsActionsButton">
<div>
<img src={ReadIcon} alt="" />
<p>Read</p>
</div>
</IconButton>
<IconButton item xs={4} className="DetailsActionsButton">
<div className="MiddleButton">
<img src={ListenIcon} alt="" />
<p>Listen</p>

</div>
</IconButton>
<IconButton item xs={4} className="DetailsActionsButton">
<div>
<img src={ShareIcon} alt="" />
<p>Share</p>
</div>
</IconButton>

</Grid>
)
}
Loading