Recreated most of the login screen with the new designs

This commit is contained in:
Tiago Ribeiro
2023-06-12 14:57:30 +01:00
parent e864e16064
commit 9ce45dfc30
4 changed files with 61 additions and 38 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 KiB

View File

@@ -5,18 +5,27 @@ interface Props {
children: ReactNode; children: ReactNode;
color?: "orange" | "green" | "blue"; color?: "orange" | "green" | "blue";
variant?: "outline" | "solid"; variant?: "outline" | "solid";
onClick: () => void; className?: string;
disabled?: boolean;
onClick?: () => void;
} }
export default function Button({color = "green", variant = "solid", children, onClick}: Props) { export default function Button({color = "green", variant = "solid", disabled = false, className, children, onClick}: Props) {
const colorClassNames: {[key in typeof color]: string} = { const colorClassNames: {[key in typeof color]: string} = {
green: "bg-mti-green hover:bg-mti-green-dark disabled:text-mti-green disabled:bg-mti-green-ultralight", green: "bg-mti-green-light hover:bg-mti-green disabled:text-mti-green disabled:bg-mti-green-ultralight selection:bg-mti-green-dark",
blue: "bg-mti-blue hover:bg-mti-blue-dark disabled:text-mti-blue disabled:bg-mti-blue-ultralight", blue: "bg-mti-blue-light hover:bg-mti-blue disabled:text-mti-blue disabled:bg-mti-blue-ultralight selection:bg-mti-blue-dark",
orange: "bg-mti-orange hover:bg-mti-orange-dark disabled:text-mti-orange disabled:bg-mti-orange-ultralight", orange: "bg-mti-orange-light hover:bg-mti-orange disabled:text-mti-orange disabled:bg-mti-orange-ultralight selection:bg-mti-orange-dark",
}; };
return ( return (
<button onClick={onClick} className={clsx("py-3 px-6 text-white", colorClassNames[color])}> <button
onClick={onClick}
className={clsx(
"py-4 px-6 text-white rounded-full transition ease-in-out duration-300 disabled:cursor-not-allowed",
className,
colorClassNames[color],
)}
disabled={disabled}>
{children} {children}
</button> </button>
); );

View File

@@ -1,3 +1,4 @@
/* eslint-disable @next/next/no-img-element */
import {User} from "@/interfaces/user"; import {User} from "@/interfaces/user";
import {toast, ToastContainer} from "react-toastify"; import {toast, ToastContainer} from "react-toastify";
import axios from "axios"; import axios from "axios";
@@ -5,8 +6,10 @@ import {FormEvent, useState} from "react";
import Head from "next/head"; import Head from "next/head";
import useUser from "@/hooks/useUser"; import useUser from "@/hooks/useUser";
import {InputText} from "primereact/inputtext"; import {InputText} from "primereact/inputtext";
import {Button} from "primereact/button";
import {Password} from "primereact/password"; import {Password} from "primereact/password";
import {Divider} from "primereact/divider";
import Button from "@/components/Low/Button";
import {BsArrowRepeat} from "react-icons/bs";
export default function Login() { export default function Login() {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
@@ -46,38 +49,49 @@ export default function Login() {
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
</Head> </Head>
<main className="w-full h-screen flex flex-col items-center justify-center bg-neutral-100"> <main className="w-full h-[100vh] flex bg-white text-black">
<ToastContainer /> <ToastContainer />
<form className="p-4 rounded-xl bg-white drop-shadow-xl flex flex-col gap-4" onSubmit={login}> <section className="h-full w-fit min-w-fit relative">
<div className="p-inputgroup"> <div className="absolute h-full w-full bg-mti-orange-light z-10 bg-opacity-50" />
<span className="p-inputgroup-addon"> <img src="/people-talking-tablet.png" alt="People smiling looking at a tablet" className="h-full aspect-auto" />
<i className="pi pi-inbox"></i> </section>
</span> <section className="h-full w-full flex flex-col items-center justify-center gap-2">
<InputText <div className="flex flex-col gap-2 items-center">
placeholder="E-mail..." <h1 className="font-bold text-4xl">Login to your account</h1>
<p className="self-start text-base font-normal text-mti-gray-cool">with your registered Email Address</p>
</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" type="email"
required name="email"
disabled={isLoading}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
autoComplete="username" 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"
/> />
</div> </div>
<div className="p-inputgroup"> <div className="flex flex-col gap-3 w-full">
<span className="p-inputgroup-addon"> <label className="font-normal text-base text-mti-gray-dim">Password</label>
<i className="pi pi-star"></i> <input
</span>
<Password
placeholder="Password..."
type="password" type="password"
required name="password"
feedback={false}
disabled={isLoading}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
autoComplete="current-password" placeholder="Password"
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"
/> />
</div> </div>
<Button loading={isLoading} iconPos="right" label="Login" icon="pi pi-check" /> <Button className="mt-8 w-full" color="green" disabled={isLoading}>
{!isLoading && "Login"}
{isLoading && (
<div className="flex items-center justify-center">
<BsArrowRepeat className="text-white animate-spin" size={25} />
</div>
)}
</Button>
</form> </form>
</section>
</main> </main>
</> </>
); );

View File

@@ -13,7 +13,7 @@ module.exports = {
smoke: "#F5F5F5", smoke: "#F5F5F5",
taupe: "#898492", taupe: "#898492",
dim: "#696F79", dim: "#696F79",
cool: "8692A6", cool: "#8692A6",
platinum: "#DBDBDB", platinum: "#DBDBDB",
"anti-flash": "#EAEBEC", "anti-flash": "#EAEBEC",
}, },