Skip to content

Commit

Permalink
Dia 3 - Frontend
Browse files Browse the repository at this point in the history
Front End do App 😎
  • Loading branch information
HBeserra committed Mar 26, 2020
1 parent 5f708a9 commit c5438dc
Show file tree
Hide file tree
Showing 29 changed files with 14,674 additions and 297 deletions.
14,008 changes: 14,008 additions & 0 deletions aulas/frontend/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions aulas/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.9.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1"
},
"scripts": {
Expand Down
31 changes: 1 addition & 30 deletions aulas/frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,10 @@
<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>
<title>Be The HERO</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 removed aulas/frontend/public/logo192.png
Binary file not shown.
Binary file removed aulas/frontend/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions aulas/frontend/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions aulas/frontend/public/robots.txt

This file was deleted.

38 changes: 0 additions & 38 deletions aulas/frontend/src/App.css

This file was deleted.

26 changes: 7 additions & 19 deletions aulas/frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';

import './Global.css'

import Routes from './routes'

function App() {

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Hello OmniStack
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
<Routes/>
);
}

export default App;
9 changes: 0 additions & 9 deletions aulas/frontend/src/App.test.js

This file was deleted.

84 changes: 84 additions & 0 deletions aulas/frontend/src/Global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

*{
margin: 0;
padding: 0;
outline: 0;
box-sizing: border-box;
}

body{
font: 400 14px Roboto, sans-serif;
background: #f0f0f5;
-webkit-font-smoothing: antialised;
}

input, button, textarea{
font: 400 18px Roboto, sans-serif;
}

button{
cursor: pointer;
}


form input{
width: 100%;
height: 60px;
color: #333;
border: 1px solid #dcdce6;
border-radius: 8px;
padding: 0 24px;
}

form textarea{
width: 100%;
min-height: 140px;
height: 60px;
color: #333;
border: 1px solid #dcdce6;
border-radius: 8px;
padding: 16px 24px;
line-height: 24px;
resize: vertical;
}

.button{
width: 100%;
height: 60px;
background-color: #e02041;
border: 0;
border-radius: 8px;
color: #fff;
font-weight: 700;
margin-top: 6px;
display: inline-block;
text-align: center;
text-decoration: none;
font-size: 18px;
line-height: 60px;
transition: filter s.2s;
}

.button:hover{
filter: brightness(90%);
}

.back-link{
display: flex;
align-items: center;
margin-top: 40px;
color: #41414d;
font-size: 18px;
text-decoration: none;
font-weight: 500;
transition: opacity 0.2;
}

.back-link:hover{
opacity: 0.8;
}

.back-link svg{
margin-right: 8px;
}
10 changes: 10 additions & 0 deletions aulas/frontend/src/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'


export default function Header({ children }){
return (
<header>
<h1>{ children }</h1>
</header>
)
}
Binary file added aulas/frontend/src/assets/heroes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions aulas/frontend/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions aulas/frontend/src/index.css

This file was deleted.

7 changes: 0 additions & 7 deletions aulas/frontend/src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
7 changes: 0 additions & 7 deletions aulas/frontend/src/logo.svg

This file was deleted.

58 changes: 58 additions & 0 deletions aulas/frontend/src/pages/Logon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { useState } from 'react'
import { Link, useHistory } from 'react-router-dom'
import { FiLogIn } from 'react-icons/fi'

import api from '../../services/api'

import './styles.css'

import logo from '../../assets/logo.svg'
import heroesImg from '../../assets/heroes.png'



export default function Logon() {
const [id, setId] = useState('')

const history = useHistory()

async function handleLogin(e) {
e.preventDefault()

try {
const response = await api.post('sessions', { id })
console.log(response.data.name)

localStorage.setItem('ongId', id)
localStorage.setItem('ongName', response.data.name)

history.push('/profile')
} catch (error) {
alert("Falha no login, tente novamente")
}
}

return (
<div className="logon-container">
<section className="form">
<img src={logo} alt="Be The Hero" />
<form onSubmit={handleLogin}>
<h1>Faça seu logon</h1>

<input
placeholder="Sua ID"
value={id}
onChange={e => setId(e.target.value)}
/>
<button className="button" type="submit">Entrar</button>

<Link className="back-link" to="/register">
<FiLogIn size={16} color="#e02041" />
Não tenho cadastro
</Link>
</form>
</section>
<img src={heroesImg} alt="Heroes" />
</div>
)
}
Loading

0 comments on commit c5438dc

Please sign in to comment.