{"size": 590, "ext": "js", "max_stars_repo_path": "www/wp-content/plugins/wp-recipe-maker/assets/js/admin-settings/settings/setting/Toggle.js", "max_stars_repo_name": "jgwill/lampyno", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "www/wp-content/plugins/wp-recipe-maker/assets/js/admin-settings/settings/setting/Toggle.js", "max_issues_repo_name": "jgwill/lampyno", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "www/wp-content/plugins/wp-recipe-maker/assets/js/admin-settings/settings/setting/Toggle.js", "max_forks_repo_name": "jgwill/lampyno", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.652173913, "max_line_length": 67, "alphanum_fraction": 0.6542372881}
import React from 'react';
import PropTypes from 'prop-types';
import Toggle from 'react-toggle';
import 'react-toggle/style.css'

const SettingToggle = (props) => {
    return (
        <Toggle
            className="wprm-setting-input"
            checked={props.value}
            aria-label={props.setting.name}
            onChange={(e) => props.onValueChange(e.target.checked)}
        />
    );
}

SettingToggle.propTypes = {
    setting: PropTypes.object.isRequired,
    value: PropTypes.any.isRequired,
    onValueChange: PropTypes.func.isRequired,
}

export default SettingToggle;