import { yupResolver } from "@hookform/resolvers/yup";
import { Box, Button, Divider, Stack, Typography } from "@mui/material";
import { HasChildren } from "@types";
import { FormProvider, RHFTextField } from "components/hook-form";
import { useForm } from "react-hook-form";
import * as Yup from "yup";
type AreaBoxProps = {
title: string;
} & HasChildren;
function AreaBox({ title, children }: AreaBoxProps) {
return (
{title}
{children}
);
}
type FormProps = {
email: string;
};
type Props = {
onNext?: VoidFunction;
onPrev?: VoidFunction;
};
export default function useInputEmailStep({ onNext, onPrev }: Props) {
const form = useForm({
defaultValues: {
email: "",
},
resolver: yupResolver(
Yup.object().shape({
email: Yup.string().required("必須項目です"),
})
),
});
const handleSubmit = () => {
if (onNext) {
onNext();
}
};
const handlePrev = () => {
if (onPrev) {
onPrev();
}
};
const element = (
);
return { element, values: form.getValues, setValue: form.setValue };
}