Skip to content

Commit

Permalink
➕ feat: handle form
Browse files Browse the repository at this point in the history
  • Loading branch information
Linder Hassinger committed Apr 18, 2024
1 parent 379760f commit 4df29fe
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion semana-9/todolist/src/pages/Login/index.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
import { useState } from "react";

export default function Login() {
const [values, setValues] = useState({
email: "",
password: "",
});

const handleInputChange = (event) => {
const { name, value } = event.target;
setValues({
...values,
[name]: value,
});
};

const handleSubmit = (event) => {
event.preventDefault();
console.log(values);
};

return (
<>
<section className="max-w-md m-auto flex items-center justify-center h-[100vh]">
<div className="bg-white p-6 rounded-md w-full md:w-md">
<div className="my-5">
<h2 className="text-center text-2xl font-bold">👋 Hola de nuevo</h2>
</div>
<form className="my-5">
<form className="my-5" onSubmit={handleSubmit}>
<div className="my-5">
<input
type="email"
name="email"
value={values.email}
onChange={handleInputChange}
placeholder="Ingrese su correo"
className="px-3 py-2 rounded-md border outline-none w-full"
/>
</div>
<div className="my-5">
<input
type="password"
name="password"
value={values.password}
onChange={handleInputChange}
placeholder="Ingrese su password"
className="px-3 py-2 rounded-md border outline-none w-full"
/>
Expand Down

0 comments on commit 4df29fe

Please sign in to comment.