2022-05-04 17:09:48 +01:00
|
|
|
/*
|
2023-01-03 16:55:26 +00:00
|
|
|
Copyright 2022 New Vector Ltd
|
2022-05-04 17:09:48 +01:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-01-04 16:00:13 -08:00
|
|
|
import classNames from "classnames";
|
2022-07-28 00:17:09 +02:00
|
|
|
import React, { FormEventHandler, forwardRef } 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>;
|
|
|
|
|
children: JSX.Element[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const Form = forwardRef<HTMLFormElement, FormProps>(
|
|
|
|
|
({ children, className, onSubmit }, ref) => {
|
|
|
|
|
return (
|
|
|
|
|
<form
|
|
|
|
|
onSubmit={onSubmit}
|
|
|
|
|
className={classNames(styles.form, className)}
|
|
|
|
|
ref={ref}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</form>
|
|
|
|
|
);
|
2022-07-07 23:40:29 +02:00
|
|
|
}
|
2022-07-29 15:07:35 +02:00
|
|
|
);
|