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

27 lines
654 B
React
Raw Normal View History

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;