mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-19 06:20:25 +00:00
It has been deprecated in React 19, which allows functional components to receive refs just like any other prop.
38 lines
762 B
TypeScript
38 lines
762 B
TypeScript
/*
|
|
Copyright 2022-2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import classNames from "classnames";
|
|
import {
|
|
type FC,
|
|
type Ref,
|
|
type FormEventHandler,
|
|
type ReactNode,
|
|
} from "react";
|
|
|
|
import styles from "./Form.module.css";
|
|
|
|
interface FormProps {
|
|
ref?: Ref<HTMLFormElement>;
|
|
className: string;
|
|
onSubmit: FormEventHandler<HTMLFormElement>;
|
|
children: ReactNode[];
|
|
}
|
|
|
|
export const Form: FC<FormProps> = ({ ref, children, className, onSubmit }) => {
|
|
return (
|
|
<form
|
|
onSubmit={onSubmit}
|
|
className={classNames(styles.form, className)}
|
|
ref={ref}
|
|
>
|
|
{children}
|
|
</form>
|
|
);
|
|
};
|
|
|
|
Form.displayName = "Form";
|