import { boolean, object, string } from 'yup'; import { Field as FormikField, Form, Formik, FormikHelpers } from 'formik'; import React from 'react'; import AdminBox from '@/components/admin/AdminBox'; import tw from 'twin.macro'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import Field from '@/components/elements/Field'; import Label from '@/components/elements/Label'; import Button from '@/components/elements/Button'; interface Values { name: string; description: string; source: string; target: string; readOnly: string; userMountable: string; } interface Props { action: string; title: string, initialValues?: Values; onSubmit: (values: Values, helpers: FormikHelpers) => void; children?: React.ReactNode } function MountForm ({ action, title, initialValues, children, onSubmit }: Props) { const submit = (values: Values, helpers: FormikHelpers) => { onSubmit(values, helpers); }; if (!initialValues) { initialValues = { name: '', description: '', source: '', target: '', readOnly: '0', userMountable: '0', }; } return ( { ({ isSubmitting, isValid }) => (
{children}
) }
); } export default MountForm;