import { z as zod } from 'zod'; import { useForm } from 'react-hook-form'; import { useBoolean } from 'minimal-shared/hooks'; import { zodResolver } from '@hookform/resolvers/zod'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import InputAdornment from '@mui/material/InputAdornment'; import { paths } from 'src/routes/paths'; import { RouterLink } from 'src/routes/components'; import { Iconify } from 'src/components/iconify'; import { Form, Field } from 'src/components/hook-form'; import { FormHead } from '../../../components/form-head'; import { FormDivider } from '../../../components/form-divider'; import { FormSocials } from '../../../components/form-socials'; import { SignUpTerms } from '../../../components/sign-up-terms'; // ---------------------------------------------------------------------- export type SignUpSchemaType = zod.infer; export const SignUpSchema = zod.object({ firstName: zod.string().min(1, { message: 'First name is required!' }), lastName: zod.string().min(1, { message: 'Last name is required!' }), email: zod .string() .min(1, { message: 'Email is required!' }) .email({ message: 'Email must be a valid email address!' }), password: zod .string() .min(1, { message: 'Password is required!' }) .min(6, { message: 'Password must be at least 6 characters!' }), }); // ---------------------------------------------------------------------- export function SplitSignUpView() { const showPassword = useBoolean(); const defaultValues: SignUpSchemaType = { firstName: '', lastName: '', email: '', password: '', }; const methods = useForm({ resolver: zodResolver(SignUpSchema), defaultValues, }); const { handleSubmit, formState: { isSubmitting }, } = methods; const onSubmit = handleSubmit(async (data) => { try { await new Promise((resolve) => setTimeout(resolve, 500)); console.info('DATA', data); } catch (error) { console.error(error); } }); const renderForm = () => ( ), }, }} /> ); return ( <> {`Already have an account? `} Get started } sx={{ textAlign: { xs: 'center', md: 'left' } }} />
{renderForm()}
{}} singInWithGithub={() => {}} signInWithTwitter={() => {}} /> ); }