scratch-www/src/components/forms/toggle-slider.jsx

26 lines
654 B
JavaScript

const classNames = require('classnames');
const PropTypes = require('prop-types');
const React = require('react');
require('./toggle-slider.scss');
const ToggleSlider = props => (
<label className={classNames('toggle-switch', props.className)} >
<input
checked={props.checked}
disabled={props.disabled}
type="checkbox"
onChange={props.onChange}
/>
<span className="slider" />
</label>
);
ToggleSlider.propTypes = {
checked: PropTypes.bool,
disabled: PropTypes.bool,
className: PropTypes.string,
onChange: PropTypes.func
};
module.exports = ToggleSlider;