aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Buttons/Button/Button.tsx
blob: 80acf8d28ba1f03adf04182bc200e7a3b37cd473 (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
28
29
30
31
32
33
34
35
36
import { ButtonPosition } from '@ts/types/app';
import { ReactNode } from 'react';
import styles from '../Buttons.module.scss';

const Button = ({
  children,
  clickHandler,
  position = 'left',
  isDisabled = false,
  isPrimary = false,
}: {
  children: ReactNode;
  clickHandler: any;
  position?: ButtonPosition;
  isDisabled?: boolean;
  isPrimary?: boolean;
}) => {
  const classes = `${styles.btn} ${
    isPrimary
      ? `${styles.primary} ${styles[`primary--${position}`]}`
      : `${styles.secondary} ${styles[`secondary--${position}`]}`
  }`;

  return (
    <button
      className={classes}
      type="button"
      disabled={isDisabled}
      onClick={clickHandler}
    >
      {children}
    </button>
  );
};

export default Button;