summaryrefslogtreecommitdiffstats
path: root/src/components/FormElements/Form/Form.tsx
blob: 10fdcdfd3961d259251b7a672ef6e94829b11d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { ReactNode } from 'react';
import styles from './Form.module.scss';

type FormKind = 'centered' | 'search' | 'settings';

const Form = ({
  children,
  submitHandler,
  kind,
  id,
}: {
  children: ReactNode;
  submitHandler: any;
  kind?: FormKind;
  id?: string;
}) => {
  const kindStyles = kind ? styles[kind] : '';
  const classes = `${styles.wrapper} ${kindStyles}`;

  return (
    <form onSubmit={submitHandler} className={classes} id={id}>
      {children}
    </form>
  );
};

export default Form;