more types

This commit is contained in:
Timo K 2022-07-28 00:17:09 +02:00
commit 3727bfb67f
5 changed files with 38 additions and 19 deletions

View file

@ -15,16 +15,25 @@ limitations under the License.
*/
import classNames from "classnames";
import React, { forwardRef } from "react";
import React, { FormEventHandler, forwardRef } from "react";
import styles from "./Form.module.css";
export const Form = forwardRef<HTMLFormElement, { className: string }>(
({ children, className, ...rest }, ref) => {
return (
<form {...rest} className={classNames(styles.form, className)} ref={ref}>
{children}
</form>
);
export const Form = forwardRef<
HTMLFormElement,
{
className: string;
onSubmit: FormEventHandler<HTMLFormElement>;
children: JSX.Element[];
}
);
>(({ children, className, onSubmit }, ref) => {
return (
<form
onSubmit={onSubmit}
className={classNames(styles.form, className)}
ref={ref}
>
{children}
</form>
);
});