aboutsummaryrefslogtreecommitdiffstats
path: root/public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js
blob: f9c79560f9d1fa7ed7b8ee61fda919d5d9e102f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Button({ children, modifiers, onClickHandler, type = "button" }) {
  let classNames = "btn";

  if (modifiers && modifiers.length > 0) {
    for (let i = 0; i < modifiers.length; i++) {
      classNames += ` btn--${modifiers[i]}`;
    }
  }

  return (
    <button type={type} className={classNames} onClick={onClickHandler}>
      {children}
    </button>
  );
}

export default Button;