summaryrefslogtreecommitdiffstats
path: root/src/components/Form/Form.tsx
blob: 44763c4c0603dbc099c35c7de630a258bff9c9f0 (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
import { ReactNode } from 'react';
import styles from './Form.module.scss';

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

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

export default Form;