import React from "react"; import Link from "next/link"; import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input } from "@plane/ui"; // types type EmailPasswordFormValues = { email: string; password?: string; confirm_password: string; medium?: string; }; type Props = { onSubmit: (formData: EmailPasswordFormValues) => Promise; }; export const EmailSignUpForm: React.FC = (props) => { const { onSubmit } = props; const { handleSubmit, control, watch, formState: { errors, isSubmitting, isValid, isDirty }, } = useForm({ defaultValues: { email: "", password: "", confirm_password: "", medium: "email", }, mode: "onChange", reValidateMode: "onChange", }); return ( <>
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( value ) || "Email address is not valid", }} render={({ field: { value, onChange, ref } }) => ( )} />
( )} />
{ if (watch("password") != val) { return "Your passwords do no match"; } }, }} render={({ field: { value, onChange, ref } }) => ( )} />
Already have an account? Sign in.
); };