import { zodResolver } from '@hookform/resolvers/zod'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import InputAdornment from '@mui/material/InputAdornment'; import Link from '@mui/material/Link'; import { useBoolean } from 'minimal-shared/hooks'; import { useForm } from 'react-hook-form'; import { AnimateLogoRotate } from 'src/components/animate'; import { Field, Form } from 'src/components/hook-form'; import { Iconify } from 'src/components/iconify'; import { RouterLink } from 'src/routes/components'; import { paths } from 'src/routes/paths'; import { z as zod } from 'zod'; import { FormDivider } from '../../../components/form-divider'; import { FormHead } from '../../../components/form-head'; import { FormSocials } from '../../../components/form-socials'; // ---------------------------------------------------------------------- export type SignInSchemaType = zod.infer; export const SignInSchema = zod.object({ 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 CenteredSignInView() { const showPassword = useBoolean(); const defaultValues: SignInSchemaType = { email: '', password: '', }; const methods = useForm({ resolver: zodResolver(SignInSchema), 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 = () => ( Forgot password? ), }, }} /> ); return ( <> {`Don’t have an account? `} Get started } />
{renderForm()}
{}} singInWithGithub={() => {}} signInWithTwitter={() => {}} /> ); }