ConceptPortal-public/rsconcept/frontend/src/components/Common/Form.tsx
2023-11-05 18:41:28 +03:00

21 lines
511 B
TypeScript

interface FormProps {
title?: string
dimensions?: string
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void
children: React.ReactNode
}
function Form({ title, onSubmit, dimensions = 'max-w-xs', children }: FormProps) {
return (
<form
className={`border shadow-md py-2 clr-app px-6 flex flex-col gap-3 ${dimensions}`}
onSubmit={onSubmit}
>
{ title && <h1 className='text-xl whitespace-nowrap'>{title}</h1> }
{children}
</form>
);
}
export default Form;