2022-05-04 17:09:48 +01:00
|
|
|
/*
|
2024-09-06 10:22:13 +02:00
|
|
|
Copyright 2022-2024 New Vector Ltd.
|
2022-05-04 17:09:48 +01:00
|
|
|
|
2024-09-06 10:22:13 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
Please see LICENSE in the repository root for full details.
|
2022-05-04 17:09:48 +01:00
|
|
|
*/
|
|
|
|
|
|
2022-01-04 16:00:13 -08:00
|
|
|
import classNames from "classnames";
|
2023-06-30 18:21:18 -04:00
|
|
|
import { FormEventHandler, forwardRef, ReactNode } from "react";
|
2022-07-07 23:40:29 +02:00
|
|
|
|
2022-01-04 16:00:13 -08:00
|
|
|
import styles from "./Form.module.css";
|
|
|
|
|
|
2022-07-29 15:07:35 +02:00
|
|
|
interface FormProps {
|
|
|
|
|
className: string;
|
|
|
|
|
onSubmit: FormEventHandler<HTMLFormElement>;
|
2023-03-13 18:40:16 -04:00
|
|
|
children: ReactNode[];
|
2022-07-29 15:07:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const Form = forwardRef<HTMLFormElement, FormProps>(
|
|
|
|
|
({ children, className, onSubmit }, ref) => {
|
|
|
|
|
return (
|
|
|
|
|
<form
|
|
|
|
|
onSubmit={onSubmit}
|
|
|
|
|
className={classNames(styles.form, className)}
|
|
|
|
|
ref={ref}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</form>
|
|
|
|
|
);
|
2023-10-11 10:42:04 -04:00
|
|
|
},
|
2022-07-29 15:07:35 +02:00
|
|
|
);
|
2023-12-19 11:00:33 -05:00
|
|
|
|
|
|
|
|
Form.displayName = "Form";
|