Auth Components
Course: PayTM project - chapter 19
Full Signup component
You can break down the app into a bunch of components. The code only contains the styles of the component, not any onclick functionality.
1. Heading component
Section titled “1. Heading component”
Code
export function Heading({label}) { return <div className="font-bold text-4xl pt-6"> {label} </div>}2. Sub Heading component
Section titled “2. Sub Heading component”
Code
export function SubHeading({label}) { return <div className="text-slate-500 text-md pt-1 px-4 pb-4"> {label} </div>}3. InputBox component
Section titled “3. InputBox component”
Code
export function InputBox({label, placeholder}) { return <div> <div className="text-sm font-medium text-left py-2"> {label} </div> <input placeholder={placeholder} className="w-full px-2 py-1 border rounded border-slate-200" /> </div>}4. Button Component
Section titled “4. Button Component”
Code
export function Button({label, onClick}) { return <button onClick={onClick} type="button" class=" w-full text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2">{label}</button>}This section was blindly copied from https://flowbite.com/docs/components/buttons/
5. BottomWarning
Section titled “5. BottomWarning”
Code
import { Link } from "react-router-dom"
export function BottomWarning({label, buttonText, to}) { return <div className="py-2 text-sm flex justify-center"> <div> {label} </div> <Link className="pointer underline pl-1 cursor-pointer" to={to}> {buttonText} </Link> </div>}Full Signup component
Section titled “Full Signup component”
Code
$1bFull Signin component
Section titled “Full Signin component”Code
import { BottomWarning } from "../components/BottomWarning"import { Button } from "../components/Button"import { Heading } from "../components/Heading"import { InputBox } from "../components/InputBox"import { SubHeading } from "../components/SubHeading"
export const Signin = () => {
return <div className="bg-slate-300 h-screen flex justify-center"> <div className="flex flex-col justify-center"> <div className="rounded-lg bg-white w-80 text-center p-2 h-max px-4"> <Heading label={"Sign in"} /> <SubHeading label={"Enter your credentials to access your account"} /> <InputBox placeholder="harkirat@gmail.com" label={"Email"} /> <InputBox placeholder="123456" label={"Password"} /> <div className="pt-4"> <Button label={"Sign in"} /> </div> <BottomWarning label={"Don't have an account?"} buttonText={"Sign up"} to={"/signup"} /> </div> </div> </div>}