Sha256: 656f6767ed34dfd443de004defa5e881e9a9558935b89041c7171233943332d3
Contents?: true
Size: 950 Bytes
Versions: 80
Compression:
Stored size: 950 Bytes
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { useSelector, useDispatch } from 'react-redux'; import { selectSettings } from '../InventorySettingsSelectors'; import { handleToggle } from './AdvancedSettingActions'; import SwitcherPF4 from '../../../../common/Switcher/SwitcherPF4'; import { settingsDict } from './AdvancedSettingsConstants'; const AdvancedSetting = ({ setting }) => { const settingValue = useSelector(store => selectSettings(store)[setting]); const dispatch = useDispatch(); const onToggle = () => dispatch(handleToggle(settingsDict[setting].name, settingValue)); return ( <SwitcherPF4 id={settingsDict[setting].name} label={settingsDict[setting].label} tooltip={settingsDict[setting].tooltip} isChecked={settingValue} onChange={onToggle} /> ); }; AdvancedSetting.propTypes = { setting: PropTypes.string.isRequired, }; export default AdvancedSetting;
Version data entries
80 entries across 80 versions & 1 rubygems