import { FunctionComponent, DetailedHTMLProps, FormHTMLAttributes } from 'react'
import { FormProvider, useForm } from '../hooks/useForm'

interface IForm {
  initialValues: any
}

const Form: FunctionComponent<IForm &
  DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>> = ({
  children,
  initialValues,
  ...props
}) => {
  return (
    <FormProvider value={initialValues}>
      <form {...props}>{children}</form>
    </FormProvider>
  )
}

export default Form
