bugfix - fixed UI for the signup modal

This commit is contained in:
James Wyndham 2024-02-21 17:23:53 +08:00
parent f4864a9684
commit 7d6cf57432
3 changed files with 150 additions and 29 deletions

View File

@ -0,0 +1,7 @@
export const companySizeList = [
"1-10 employees",
"10-30 employees",
"30-70 employees",
"70-100 employees",
"100+ employees"
]

View File

@ -36,11 +36,6 @@ function ModalSignIn() {
</h3> </h3>
<p className="text-sm md:text-base">Lets kick some more ass?</p> <p className="text-sm md:text-base">Lets kick some more ass?</p>
</div> </div>
{/* <ModalSignInForm
textOnUse={"textOnUse"}
setStatus={setStatus}
ref={formRef}
/> */}
<form onSubmit={handleSubmit(() => {})} className="w-full md:w-2/3"> <form onSubmit={handleSubmit(() => {})} className="w-full md:w-2/3">
<div className="relative mt-6"> <div className="relative mt-6">
<input <input

View File

@ -5,15 +5,19 @@ import React, { useRef, useState } from "react";
import { ModalStatus } from "@/types"; import { ModalStatus } from "@/types";
import { FormRefMethods } from "../ModalSignIn/ModalSignInForm"; import { FormRefMethods } from "../ModalSignIn/ModalSignInForm";
import Icon from "@/components/icon"; import Icon from "@/components/icon";
import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import { signUpValidationSchema } from "@/utils/form";
import { companySizeList } from "@/constants";
function ModalSignUp() { function ModalSignUp() {
const formRef = useRef<FormRefMethods>(null); const {
const handleCloseModal = () => { register,
if (formRef.current) { handleSubmit,
formRef.current.resetForm(); formState: { errors },
} } = useForm({
}; resolver: yupResolver(signUpValidationSchema),
});
return ( return (
<> <>
<input <input
@ -26,32 +30,147 @@ function ModalSignUp() {
<label htmlFor="sign-up-modal" className="modal cursor-pointer"> <label htmlFor="sign-up-modal" className="modal cursor-pointer">
<label className="modal-box relative max-w-full md:max-w-[550px] py-4 px-3 md:p-6"> <label className="modal-box relative max-w-full md:max-w-[550px] py-4 px-3 md:p-6">
<div className="flex justify-end pb-2 select-none"> <div className="flex justify-end pb-2 select-none">
<label <label htmlFor="sign-up-modal" className="cursor-pointer">
onClick={handleCloseModal}
htmlFor="sign-up-modal"
className="cursor-pointer"
>
<Icon name="Dismiss20Filled" size="medium" /> <Icon name="Dismiss20Filled" size="medium" />
</label> </label>
</div> </div>
<div <div
className="w-[100%] bg-gradient-to-r from-primary to-secondary px-6 pt-2 pb-6" className="w-[100%] bg-gradient-to-r from-primary to-secondary px-6 pt-2 mt-3 pb-6 rounded-lg"
data-aos="fade-up" data-aos="fade-up"
> >
<h3 className="pb-2 text-lg md:text-3xl pt-6"> <h3 className="pb-1 text-3xl font-bold md:text-3xl pt-6">
{/* {textOnUse.title} */} We Are Growing Fast, and We Want You To Join The Party!
</h3> </h3>
<p className="text-xs md:text-base">{/* {textOnUse.subTitle} */}</p> <p className="text-sm md:text-base">
Excited to see what we&apos;ve got! Signup and get started!
</p>
</div>
<form onSubmit={handleSubmit(() => {})} className="w-full md:w-2/3">
<div className="relative mt-6">
<input
{...register("email")}
type="text"
id="SignUpEmail"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="Email…"
aria-label="Email…"
autoComplete="on"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1">
<input
{...register("first_name")}
id="SignUpFirstName"
type="text"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="First Name…"
aria-label="First Name…"
autoComplete="on"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1">
<input
{...register("last_name")}
id="SignUpLastName"
type="text"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="Last Name…"
aria-label="Last Name…"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div> </div>
{/* <ModalSignUpForm <div className="relative mt-1">
generateCheckoutSession={false} <input
companySizeList={companySizeList} {...register("phone_number")}
textOnUse={textOnUse} id="SignUpPhoneNumber"
setStatus={setStatus} type="text"
getPriceId={getPriceId} className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
ref={formRef} placeholder="Phone Number…"
/> */} aria-label="Phone Number…"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1">
<input
{...register("organisation")}
id="SignUpOrganisation"
type="text"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="Organisation…"
aria-label="Organisation…"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1">
<select
{...register("company_size")}
id="SignUpCompanySize"
defaultValue={""}
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
>
<option className="bg-gray-850" value={""} disabled>
Company Size
</option>
{companySizeList.map((companySizeOption, i) => {
return (
<option
className="bg-gray-850"
value={companySizeOption}
key={i}
>
{companySizeOption}
</option>
);
})}
</select>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1">
<input
{...register("password")}
id="SignUpPwd"
type="password"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="Password..."
aria-label="Password"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<div className="relative mt-1 mb-2">
<input
{...register("passwordConfirmation")}
id="SignUpPwdConfirm"
type="password"
className="py-3 px-4 block w-full bg-base-200 text-base-content border-white rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none "
placeholder="Confirmed Password..."
aria-label="Confirmed Password"
/>
<div className="text-start text-sm italic text-error-content">
{errors.email?.message}&nbsp;
</div>
</div>
<button type="submit" className="btn btn-primary">
Sign Up
</button>
</form>
</label> </label>
</label> </label>
</> </>