"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import { Icon } from "@iconify/react"; import { Button, Checkbox, Divider, Input, Link } from "@nextui-org/react"; import { useState } from "react"; import { useFormState } from "react-dom"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { authenticate } from "@/actions"; import { Form, FormControl, FormField, FormMessage, } from "@/components/ui/form"; import { authFormSchema } from "@/types"; import { ProwlerExtended } from "../icons"; import { ThemeSwitch } from "../ThemeSwitch"; import { CustomInput } from "../ui/custom"; import { AuthButton } from "./AuthButton"; export const AuthForm = ({ type }: { type: string }) => { const [user, setUser] = useState(null); const [state, dispath] = useFormState(authenticate, undefined); const form = useForm>({ resolver: zodResolver(authFormSchema), defaultValues: { username: "", password: "", }, }); const onSubmit = (values: z.infer) => { // Do something with the form values // this will be type-safe and validated console.log(values); }; console.log(state); return (
{/* Brand Logo and ThemeSwitch */}
{/* Testimonial */}

“ Open Cloud Security ”

{type === "sign-in" ? "Sign In" : "Sign Up"}

{/* Sign UP Form */} {type === "sign-up" && (
{/* {isConfirmVisible ? ( ) : ( )} } label="Confirm Password" name="confirmPassword" placeholder="Confirm your password" type={isConfirmVisible ? "text" : "password"} variant="bordered" /> */} I agree with the  Terms   and  Privacy Policy )} {/* Sign IN Form */} {type === "sign-in" && ( <>
Remember me Forgot password?

OR

)} {type === "sign-in" ? (

Need to create an account?  Sign Up

) : (

Already have an account?  Log In

)}
); };