2023-07-15 17:46:19 +03:00
|
|
|
interface FormProps {
|
|
|
|
title: string
|
2023-09-15 23:29:52 +03:00
|
|
|
dimensions?: string
|
2023-07-15 17:46:19 +03:00
|
|
|
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void
|
|
|
|
children: React.ReactNode
|
|
|
|
}
|
|
|
|
|
2023-09-15 23:29:52 +03:00
|
|
|
function Form({ title, onSubmit, dimensions = 'max-w-xs', children }: FormProps) {
|
2023-07-15 17:46:19 +03:00
|
|
|
return (
|
2023-09-15 23:29:52 +03:00
|
|
|
<form
|
|
|
|
className={`border shadow-md py-2 clr-app px-6 flex flex-col gap-3 ${dimensions}`}
|
|
|
|
onSubmit={onSubmit}
|
|
|
|
>
|
|
|
|
{ title && <h1 className='text-xl font-bold whitespace-nowrap'>{title}</h1> }
|
|
|
|
{children}
|
|
|
|
</form>
|
2023-07-15 17:46:19 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
export default Form;
|