Extracted the Input into its own component

This commit is contained in:
Tiago Ribeiro
2023-06-15 10:10:33 +01:00
parent 60217e9a66
commit 65ebdd7dde
4 changed files with 76 additions and 89 deletions

View File

@@ -9,6 +9,7 @@ import {Divider} from "primereact/divider";
import Button from "@/components/Low/Button";
import {BsArrowRepeat} from "react-icons/bs";
import Link from "next/link";
import Input from "@/components/Low/Input";
export default function Login() {
const [email, setEmail] = useState("");
@@ -62,34 +63,8 @@ export default function Login() {
</div>
<Divider className="max-w-md" />
<form className="flex flex-col items-center gap-6 w-1/2" onSubmit={login}>
<div className="flex flex-col gap-3 w-full">
<label className="font-normal text-base text-mti-gray-dim">Email address</label>
<input
type="email"
name="email"
onChange={(e) => setEmail(e.target.value)}
placeholder="Enter email address"
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
/>
</div>
<div className="relative flex flex-col gap-3 w-full">
<label className="font-normal text-base text-mti-gray-dim">Password</label>
<div className="w-full h-fit relative">
<input
type={showPassword ? "text" : "password"}
name="password"
onChange={(e) => setPassword(e.target.value)}
placeholder="Password"
className="w-full px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
/>
<p
role="button"
onClick={() => setShowPassword((prev) => !prev)}
className="text-xs cursor-pointer absolute bottom-1/2 translate-y-1/2 right-8">
{showPassword ? "Hide" : "Show"}
</p>
</div>
</div>
<Input type="email" name="email" onChange={(e) => setEmail(e)} placeholder="Enter email address" />
<Input type="password" name="password" onChange={(e) => setPassword(e)} placeholder="Password" />
<Button className="mt-8 w-full" color="green" disabled={isLoading}>
{!isLoading && "Login"}
{isLoading && (