Skip to content

Commit

Permalink
caminho de tela incial para login criado #38
Browse files Browse the repository at this point in the history
  • Loading branch information
biancabsouza23 committed May 28, 2024
1 parent b7151dc commit 396b933
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Fronted/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import PaginaInicial from "./componentes/inicial";
import FormularioCadastro from "./componentes/FormularioCadastro";
import FormularioLogin from "./componentes/FormularioLogin"; // Importa o componente FormularioLogin
import MeuPerfil from "./componentes/MeuPerfil";
import EditPerfil from "./componentes/EditPerfil"; // Importe o componente EditPerfil

Expand All @@ -11,6 +12,7 @@ function App() {
<Routes>
<Route path="/" element={<PaginaInicial />} />
<Route path="/cadastro" element={<FormularioCadastro />} />
<Route path="/login" element={<FormularioLogin />} /> {/* Nova rota */}
<Route path="/meu-perfil" element={<MeuPerfil />} />
<Route path="/editar-perfil" element={<EditPerfil />} /> {/* Nova rota */}
</Routes>
Expand Down
41 changes: 41 additions & 0 deletions Fronted/src/componentes/FormularioLogin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* src/componentes/FormularioLogin.css */
form {
display: flex;
flex-direction: column;
width: 100%;
max-width: 400px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
background-color: #f9f9f9;
}

div {
margin-bottom: 20px;
}

input {
width: 100%;
padding: 30px; /* Aumentar o padding para tornar os campos mais altos */
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}

button {
padding: 30px; /* Aumentar o padding para tornar o botão mais alto */
font-size: 16px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #0056b3;
}

57 changes: 57 additions & 0 deletions Fronted/src/componentes/FormularioLogin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom'; // Importa useNavigate
import './FormularioLogin.css';

const FormularioLogin = () => {
const [formData, setFormData] = useState({
username: '',
password: '',
});

const navigate = useNavigate(); // Inicializa o useNavigate

const handleChange = (e) => {
const { name, value } = e.target;
setFormData((prevFormData) => ({
...prevFormData,
[name]: value,
}));
};

const handleSubmit = (e) => {
e.preventDefault();
console.log('Dados do login enviados:', formData);
// Aqui você pode adicionar a lógica para enviar os dados para o servidor

// Redireciona para a página de perfil após o envio do formulário
navigate('/meu-perfil');
};

return (
<form onSubmit={handleSubmit}>
<div>
<input
type="text"
id="username"
name="username"
placeholder="Nome de usuário"
value={formData.username}
onChange={handleChange}
/>
</div>
<div>
<input
type="password"
id="password"
name="password"
placeholder="Senha"
value={formData.password}
onChange={handleChange}
/>
</div>
<button type="submit">Entrar</button>
</form>
);
};

export default FormularioLogin;
6 changes: 5 additions & 1 deletion Fronted/src/componentes/inicial.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ function Inicial() {
navigate("/cadastro");
};

const handleLoginClick = () => {
navigate("/login");
};

return (
<div>
<header>
Expand All @@ -20,7 +24,7 @@ function Inicial() {
<img src={logo} alt="Logo da Lelove" width="75" />
</figure>
</div>
<button className="buttons">Entrar</button>
<button className="buttons" onClick={handleLoginClick}>Entrar</button>
</nav>
</header>

Expand Down

0 comments on commit 396b933

Please sign in to comment.