summaryrefslogtreecommitdiff
path: root/src/components/Switch.js
blob: afc4b5b1fa909b9740f13c3858e97044d9c028f3 (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 React from 'react';
import PropTypes from 'prop-types';

import s0 from './Switch.module.css';
const noop = () => {};

function Switch({ checked = false, onChange = noop, name = '' }) {
  return (
    <div>
      <input
        type="checkbox"
        name={name}
        checked={checked}
        className={s0.switch}
        onChange={onChange}
      />
    </div>
  );
}

Switch.propTypes = {
  checked: PropTypes.bool,
  onChange: PropTypes.func,
  name: PropTypes.string
};

export default React.memo(Switch);