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

first_update #3

Open
wants to merge 6 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
Binary file added assets/GRAB-LOGO - Atalho.lnk
Binary file not shown.
Binary file added assets/GRAB-LOGO.jpg
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 assets/undraw_interview_rmcf 2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 51 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Grab - Login</title>
</head>
<body>

</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="stylesheet.css" rel="stylesheet">
<title>Grab - Login</title>

</head>

<body>

<section class="container">

<div class="left__blue">

<div class="title">
<h1>GRAB</h1>
<img src="./assets/logo-grab.svg">
</div>

<form>

<div class="form">
<input name="email" type="text" id="email" >
<input name="password" type="password" id="password">
</div>

<div class="button">
<button type="submit">Entrar</button>
</div>

</form>

<div class="solve__problem">
<div class="solve__problem__child">
<p><a href="#">Problemas para entrar? Clique aqui</a></p>
</div>
</div>

</div>
<div class="image">
<img src="./assets/undraw_interview_rmcf 2.jpg">
</div>

</section>

<script src="script.js"></script>
</body>

</html>
54 changes: 54 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//transformando a função em assincrona
async function onSubmit(event){
event.preventDefault()
const emailInput = event.target.elements["email"]
const passwordInput = event.target.elements["password"]
passwordInput.classList.remove("error")
emailInput.classList.remove("error")
const isEmailValid = validateEmail(emailInput.value)
const isPasswordValid = checkPassword(passwordInput.value)
if(!isEmailValid){
emailInput.classList.add("error")
}
else{
emailInput.classList.remove("error")
}
if(!isPasswordValid){
passwordInput.classList.add("error")
}
else{
passwordInput.classList.remove("error")
}
const body = JSON.stringify({
email:emailInput.value,
password:passwordInput.value
})
const response = await fetch('http://localhost:3000/login', {
method:"POST",
headers: {
'Content-Type': 'application/json',
},
body
})
const data = await response.json()

console.log(data)
}

const form = document.querySelector("form")
form.addEventListener('submit', onSubmit)


function validateEmail(email) {
var re = /\S+@\S+\.\S+/;
return re.test(email);
}

function checkPassword(str) {
if(str.length < 5 || str.length >10){
return false
}
var re = /^(?=.*\d)(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z]).{8,}$/;
return re.test(str);
}

88 changes: 88 additions & 0 deletions stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
body{

max-width: 700px;
margin: 0px;

}

button{
border-radius: 10px;
background-color: #E5E5E5;
border: 1px #E5E5E5;
display: flex;
justify-content: space-between;
margin: auto;

}
.error{
border: 2px solid #FF5757;
}

.container{
display: flex;
width: 97vw;
height: 97vh;
}

.left__blue{
background: #4E5BEE;
justify-content: center;
display: flex;
align-items: center;
flex-direction: column;
}

h1{
display: none;
}

input{
border-radius: 10px;
border: 2px #F8F8F8 solid;
display: flex;
justify-content: space-between;
margin: 5px;
background-color: #4E5BEE;
}

.solve__problem{
text-align: center;
display: flex;
justify-content: flex-end;
}

a:link {
color: white;
text-decoration: none;
}
p > a{
color: white;
text-align:end;
}
.title > img{
width: auto;
height: 100px;
padding: 100px;
margin: auto;
}


.image > img{
max-width: 800px;
max-height: fit-content;
margin: 0px;
padding:0px;
}

@media screen and (max-width:800px){

.image{
display:none;
}
.left__blue{
width: 100%;
height: 100%;
padding: 0px;
margin:0px;
}
}