Sha256: 9ac7b2568051539f39a7fb4d28e6ae78c580e24031ee1776f761ab88744efae3
Contents?: true
Size: 1.76 KB
Versions: 85
Compression:
Stored size: 1.76 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Switch, Level, LevelItem } from '@patternfly/react-core'; import { OverlayTrigger, Tooltip, Icon, Grid, ControlLabel, noop, } from 'patternfly-react'; const Switcher = ({ id, label, tooltip, isChecked, onChange, labelCol = 5, SwitchCol = 2, }) => ( <React.Fragment> <Grid.Col sm={labelCol}> <ControlLabel className="control-label" style={{ paddingTop: '0' }}> <Level> <LevelItem> <span className={`rh-cloud-switcher-${id}-label`}>{label}</span> </LevelItem> <LevelItem> <OverlayTrigger overlay={ <Tooltip id={`rh-cloud-switcher-${id}-tooltip`} style={{ zIndex: 10000 }} > {tooltip} </Tooltip> } placement="bottom" trigger={['hover', 'focus']} rootClose={false} > <Icon type="pf" name="info" /> </OverlayTrigger> </LevelItem> </Level> </ControlLabel> </Grid.Col> <Grid.Col sm={SwitchCol} style={{ marginBottom: '5px' }}> <Switch id={`rh-cloud-switcher-${id}`} isChecked={isChecked} onChange={onChange} label=" " /> </Grid.Col> </React.Fragment> ); Switcher.propTypes = { id: PropTypes.string.isRequired, label: PropTypes.string, tooltip: PropTypes.string, isChecked: PropTypes.bool, onChange: PropTypes.func, labelCol: PropTypes.number, SwitchCol: PropTypes.number, }; Switcher.defaultProps = { label: null, tooltip: null, isChecked: true, onChange: noop, labelCol: 5, SwitchCol: 2, }; export default Switcher;
Version data entries
85 entries across 85 versions & 1 rubygems